Commit dc613930 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Merge branch '57-admin-interface-gebruiker-toevoegen-vs-gebruiker-veranderen' into 'master'

Add name, email to add user form

Closes #57


See merge request !44
parents 870cdf9f e2e78452
......@@ -4,6 +4,7 @@ This module registers admin pages for the models
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm as BaseUserCreationForm
from django.utils.translation import ugettext_lazy as _
from . import models
......@@ -42,14 +43,27 @@ class MembershipTypeListFilter(admin.SimpleListFilter):
return queryset.filter(pk__in=users)
class UserCreationForm(BaseUserCreationForm):
class Meta(BaseUserCreationForm.Meta):
fields = ('username', 'first_name', 'last_name')
class UserAdmin(BaseUserAdmin):
add_form = UserCreationForm
inlines = (MemberInline, MembershipInline)
# FIXME include proper filter for expiration
# https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
list_filter = (MembershipTypeListFilter,
'is_superuser',)
# FIXME use nicer form
# form = forms.AdminForm (base on ModelForm, reorder elements, etc).
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('first_name', 'last_name', 'username', 'email',
'password1', 'password2'),
}),
)
admin.site.register(models.BecomeAMemberDocument)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment