Browse Source

Add a user field specifically for XMPP, because it needs to be handled a little differently to the user profiles (different mf2 property, stuff like that)

pull/1/head
Danielle McLean 5 years ago
parent
commit
6b51531cb4
Signed by: 00dani
GPG Key ID: 5A5D2D1AFF12EEC5
  1. 5
      home/templates/home/index.html
  2. 2
      users/admin.py
  3. 20
      users/migrations/0009_user_xmpp.py
  4. 2
      users/models.py

5
home/templates/home/index.html

@ -30,6 +30,11 @@
<li>
<a class="u-email" rel="me" href="mailto:{{ user.email }}"><i class="fa fa-envelope"></i> {{ user.email }}</a>
</li>
{% if user.xmpp %}
<li>
<a class="u-impp" rel="me" href="xmpp:{{ user.xmpp }}"><i class="openwebicons-xmpp"></i> {{ user.xmpp }}</a>
</li>
{% endif %}
{% for profile in user.profiles.all %}<li>
<a class="u-url" rel="me" href="{{ profile.url }}"><i class="{{ profile.site.icon }}"></i> {{ profile.name }}</a>
</li>{% endfor %}

2
users/admin.py

@ -19,7 +19,7 @@ class ProfileInline(admin.TabularInline):
class UserAdmin(BaseUserAdmin):
fieldsets = BaseUserAdmin.fieldsets + (
('Profile', {'fields': ('avatar', 'note')}),
('Profile', {'fields': ('avatar', 'xmpp', 'note')}),
)
inlines = (
KeyInline,

20
users/migrations/0009_user_xmpp.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-06 10:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0008_auto_20171031_1357'),
]
operations = [
migrations.AddField(
model_name='user',
name='xmpp',
field=models.EmailField(blank=True, max_length=254),
),
]

2
users/models.py

@ -33,6 +33,8 @@ class Site(models.Model):
class User(ModelMeta, AbstractUser):
avatar = models.ImageField(upload_to=avatar_path)
note = models.TextField(blank=True)
xmpp = models.EmailField(blank=True)
# This is gonna need to change if I ever decide to add multiple-user support ;)
url = '/'

Loading…
Cancel
Save