Added all the notifications fields to the user admin panel
parent
dc090766da
commit
19177a4773
|
@ -29,6 +29,7 @@ class UserAdmin(DjangoUserAdmin):
|
||||||
(None, {'fields': ('username', 'password')}),
|
(None, {'fields': ('username', 'password')}),
|
||||||
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email', 'description', 'photo')}),
|
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email', 'description', 'photo')}),
|
||||||
(_('Extra info'), {'fields': ('color', 'default_language', 'default_timezone', 'token', 'colorize_tags')}),
|
(_('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',)}),
|
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',)}),
|
||||||
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
|
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
from django import forms
|
||||||
from django.contrib.auth.forms import UserCreationForm as DjangoUserCreationForm, UserChangeForm as DjangoUserChangeForm
|
from django.contrib.auth.forms import UserCreationForm as DjangoUserCreationForm, UserChangeForm as DjangoUserChangeForm
|
||||||
from greenmine.base.models import User
|
from greenmine.base.models import User
|
||||||
|
|
||||||
|
|
||||||
class UserCreationForm(DjangoUserCreationForm):
|
class UserCreationForm(DjangoUserCreationForm):
|
||||||
def clean_username(self):
|
def clean_username(self):
|
||||||
# Since User.username is unique, this check is redundant,
|
# Since User.username is unique, this check is redundant,
|
||||||
|
@ -16,7 +18,11 @@ class UserCreationForm(DjangoUserCreationForm):
|
||||||
model = User
|
model = User
|
||||||
fields = ('username',)
|
fields = ('username',)
|
||||||
|
|
||||||
|
|
||||||
class UserChangeForm(DjangoUserChangeForm):
|
class UserChangeForm(DjangoUserChangeForm):
|
||||||
|
notify_level = forms.ChoiceField(choices=User.NOTIFY_LEVEL_CHOICES)
|
||||||
|
notify_changes_by_me = forms.BooleanField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue