1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-07-06 20:54:01 +02:00

Remove custom add user view

This commit is contained in:
Alexandre Iooss
2019-08-09 22:52:47 +02:00
parent de9650d33a
commit d1806fd727
6 changed files with 29 additions and 38 deletions

View File

@ -9,6 +9,7 @@ from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from reversion.admin import VersionAdmin
from .forms import UserCreationAdminForm
from .models import Adhesion, Clef, Request, User
@ -18,7 +19,7 @@ class RequestAdmin(admin.ModelAdmin):
class ClefAdmin(VersionAdmin):
list_display = ('nom', 'proprio', 'commentaire')
# TODO order by nom
ordering = ('nom',)
class AdhesionAdmin(VersionAdmin):
@ -60,6 +61,17 @@ class UserAdmin(VersionAdmin, BaseUserAdmin):
list_filter = (IsAdherentFilter, 'is_staff', 'is_superuser', 'is_active',
'groups')
# Customize required initial fields
add_form_template = 'admin/change_form.html'
add_form = UserCreationAdminForm
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ("username", "email", "first_name", "last_name",
"address", "telephone"),
}),
)
def is_adherent(self, obj):
"""
Get current membership year and check if user is there