From 19177a47738ba189964db7c40d92e0b5c2761b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 18 Jul 2013 13:40:07 +0200 Subject: [PATCH] Added all the notifications fields to the user admin panel --- greenmine/base/admin.py | 1 + greenmine/base/forms.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/greenmine/base/admin.py b/greenmine/base/admin.py index 109551f1..8fc6d2ea 100644 --- a/greenmine/base/admin.py +++ b/greenmine/base/admin.py @@ -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')}), ) diff --git a/greenmine/base/forms.py b/greenmine/base/forms.py index 5685cdbf..f356f9ca 100644 --- a/greenmine/base/forms.py +++ b/greenmine/base/forms.py @@ -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