Commit 8c0c3ec6 authored by fred's avatar fred

add phone and mobile fields to users

parent 25e7bd0b
...@@ -10,6 +10,7 @@ class UserAdmin(django.contrib.auth.admin.UserAdmin): ...@@ -10,6 +10,7 @@ class UserAdmin(django.contrib.auth.admin.UserAdmin):
fieldsets = ( fieldsets = (
(None, {'fields': ('username', 'password')}), (None, {'fields': ('username', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email', (_('Personal info'), {'fields': ('first_name', 'last_name', 'email',
'phone', 'mobile',
'emissions', 'news_categories')}), 'emissions', 'news_categories')}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
'groups', 'user_permissions')}), 'groups', 'user_permissions')}),
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('aa', '0002_auto_20150125_1431'),
]
operations = [
migrations.AlterModelOptions(
name='user',
options={'ordering': ['first_name', 'last_name']},
),
migrations.AddField(
model_name='user',
name='mobile',
field=models.CharField(max_length=20, null=True, verbose_name='Mobile', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='user',
name='phone',
field=models.CharField(max_length=20, null=True, verbose_name='Phone', blank=True),
preserve_default=True,
),
]
...@@ -3,6 +3,7 @@ import re ...@@ -3,6 +3,7 @@ import re
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.core import validators from django.core import validators
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _
from emissions.models import Emission, Episode, NewsItem, NewsCategory, SoundFile from emissions.models import Emission, Episode, NewsItem, NewsCategory, SoundFile
...@@ -10,6 +11,12 @@ class User(AbstractUser): ...@@ -10,6 +11,12 @@ class User(AbstractUser):
emissions = models.ManyToManyField(Emission, null=True, blank=True) emissions = models.ManyToManyField(Emission, null=True, blank=True)
news_categories = models.ManyToManyField(NewsCategory, null=True, blank=True) news_categories = models.ManyToManyField(NewsCategory, null=True, blank=True)
phone = models.CharField(_('Phone'), max_length=20, null=True, blank=True)
mobile = models.CharField(_('Mobile'), max_length=20, null=True, blank=True)
class Meta:
ordering = ['first_name', 'last_name']
def can_manage(self, object): def can_manage(self, object):
if self.is_staff: if self.is_staff:
return True return True
...@@ -22,3 +29,11 @@ class User(AbstractUser): ...@@ -22,3 +29,11 @@ class User(AbstractUser):
if isinstance(object, NewsItem): if isinstance(object, NewsItem):
return self.has_perm('emissions.change_newsitem') or object.emission in self.emissions.all() return self.has_perm('emissions.change_newsitem') or object.emission in self.emissions.all()
return False return False
def __unicode__(self):
s = super(User, self).__unicode__()
if self.mobile:
return '%s (%s)' % (s, self.mobile)
if self.phone:
return '%s (%s)' % (s, self.phone)
return s
...@@ -755,3 +755,19 @@ body.submitting { ...@@ -755,3 +755,19 @@ body.submitting {
opacity: 0.5; opacity: 0.5;
pointer-events: none; pointer-events: none;
} }
div#content ul.team {
padding: 0;
padding-left: 1ex;
margin: 0;
}
ul.team li {
display: inline;
padding: 0;
margin: 0;
}
ul.team li::after {
content: " / ";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment