From 0a3a35bf1bd7743381c45eae664777389bd74b31 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Thu, 15 Oct 2015 13:38:24 +0100 Subject: [PATCH] Setup useradminform correctly for profiles enabling admins to change passwords. --- .idea/dataSources.ids | 836 ------------------------------------------ .idea/modules.xml | 5 +- RIGS/admin.py | 28 +- RIGS/forms.py | 13 +- db.sqlite3 | Bin 19730432 -> 19730432 bytes 5 files changed, 39 insertions(+), 843 deletions(-) delete mode 100644 .idea/dataSources.ids diff --git a/.idea/dataSources.ids b/.idea/dataSources.ids deleted file mode 100644 index 748b0aa7..00000000 --- a/.idea/dataSources.ids +++ /dev/null @@ -1,836 +0,0 @@ - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - -
- - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - -
- - - - - - -
- - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
- - - #@ - ` - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
- - - - - - -
- - - -
- - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- - - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - -
- - - - - - - -
- - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - -
-
- - - -
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index cac4e07c..75e2a525 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,7 @@ - + - - + \ No newline at end of file diff --git a/RIGS/admin.py b/RIGS/admin.py index 37f35a8b..18dc554e 100644 --- a/RIGS/admin.py +++ b/RIGS/admin.py @@ -1,9 +1,10 @@ from django.contrib import admin -from RIGS import models +from RIGS import models, forms +from django.contrib.auth.admin import UserAdmin +from django.utils.translation import ugettext_lazy as _ import reversion # Register your models here. -admin.site.register(models.Profile) admin.site.register(models.Person, reversion.VersionAdmin) admin.site.register(models.Organisation, reversion.VersionAdmin) admin.site.register(models.VatRate, reversion.VersionAdmin) @@ -11,4 +12,25 @@ admin.site.register(models.Venue, reversion.VersionAdmin) admin.site.register(models.Event, reversion.VersionAdmin) admin.site.register(models.EventItem, reversion.VersionAdmin) admin.site.register(models.Invoice) -admin.site.register(models.Payment) \ No newline at end of file +admin.site.register(models.Payment) + +class ProfileAdmin(UserAdmin): + fieldsets = ( + (None, {'fields': ('username', 'password')}), + (_('Personal info'), { + 'fields': ('first_name', 'last_name', 'email', 'initials', 'phone')}), + (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', + 'groups', 'user_permissions')}), + (_('Important dates'), { + 'fields': ('last_login', 'date_joined')}), + ) + add_fieldsets = ( + (None, { + 'classes': ('wide',), + 'fields': ('username', 'password1', 'password2'), + }), + ) + form = forms.ProfileChangeForm + add_form = forms.ProfileCreationForm + +admin.site.register(models.Profile, ProfileAdmin) diff --git a/RIGS/forms.py b/RIGS/forms.py index 922558c3..24773475 100644 --- a/RIGS/forms.py +++ b/RIGS/forms.py @@ -3,7 +3,7 @@ from django import forms from django.utils import formats from django.conf import settings from django.core import serializers -from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm +from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AuthenticationForm, PasswordResetForm from registration.forms import RegistrationFormUniqueEmail from captcha.fields import ReCaptchaField import simplejson @@ -33,6 +33,17 @@ class LoginForm(AuthenticationForm): class PasswordReset(PasswordResetForm): captcha = ReCaptchaField(label='Captcha') +class ProfileCreationForm(UserCreationForm): + + class Meta(UserCreationForm.Meta): + model = models.Profile + + +class ProfileChangeForm(UserChangeForm): + + class Meta(UserChangeForm.Meta): + model = models.Profile + # Events Shit class EventForm(forms.ModelForm): datetime_input_formats = formats.get_format_lazy("DATETIME_INPUT_FORMATS") + settings.DATETIME_INPUT_FORMATS diff --git a/db.sqlite3 b/db.sqlite3 index 312d40402d39dc24dc83df96251c2fc3c375a0c0..b9c15eb2486ad3865b1617c12586ecd58a7f85bf 100644 GIT binary patch delta 3139 zcmcK6dvp}l9S88ab2r&!$(x605S9=O1PJrk*+)clVUv)M**w^gOh7ToZZ`YM=E-K4 zw&B%PER9laGp((mN^PsHmBzYll_a&arSyS)AuU=8KB<&~QYo62ekVc6@!;XF?m3_D zoU?Q1ckax+cjj*0`%LOqcpx`@lwsC77{=bhFs!s^ktJ!AS@s6q?^X;%KRjY6J&>bk zjSM|RAEGi%W=GgCYaE_+$iVi?`c%d~ohQo)D{#EDjOUi|l93mRMN6^36pO=O!+oMZ=$4Ou7Bk|-g``iV?_ z@YG9rS$cYep_k}8^lkbYJxY%ZXB~TvW+YRVFuV1WhveZ`ju$M-($O;v!`#|RKcMf? z^YqNsvX{h)r?VNR{PZ-$Iz6IRXF%I@b{@m}*m<;!9;bWgv+OY%WCvIWJ52M~q3pYt zkTVJNDu?vvQ<<2XC9&CU@mPb=Koo@NiTP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