Added all the notifications fields to the user admin panel

remotes/origin/enhancement/email-actions
David Barragán Merino 2013-07-18 13:40:07 +02:00
parent dc090766da
commit 19177a4773
2 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class UserAdmin(DjangoUserAdmin):
(None, {'fields': ('username', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email', 'description', 'photo')}),
(_('Extra info'), {'fields': ('color', 'default_language', 'default_timezone', 'token', 'colorize_tags')}),
(_('Notifications info'), {'fields': ("notify_level", "notify_changes_by_me",)}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',)}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)

View File

@ -1,6 +1,8 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm as DjangoUserCreationForm, UserChangeForm as DjangoUserChangeForm
from greenmine.base.models import User
class UserCreationForm(DjangoUserCreationForm):
def clean_username(self):
# Since User.username is unique, this check is redundant,
@ -16,7 +18,11 @@ class UserCreationForm(DjangoUserCreationForm):
model = User
fields = ('username',)
class UserChangeForm(DjangoUserChangeForm):
notify_level = forms.ChoiceField(choices=User.NOTIFY_LEVEL_CHOICES)
notify_changes_by_me = forms.BooleanField()
class Meta:
model = User