You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.4 KiB
40 lines
1.4 KiB
from django.contrib import admin
|
|
from .models import Club, TeamScore, Tournament, CustomUser, Event, Round, GroupStage, Match, TeamRegistration, PlayerRegistration
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
|
|
|
|
from .forms import CustomUserCreationForm, CustomUserChangeForm
|
|
|
|
|
|
class CustomUserAdmin(UserAdmin):
|
|
form = CustomUserChangeForm
|
|
add_form = CustomUserCreationForm
|
|
model = CustomUser
|
|
list_display = ['email', 'username', 'umpire_code']
|
|
fieldsets = [
|
|
(None, {'fields': ['username', 'email', 'password', 'umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id', ]}),
|
|
]
|
|
add_fieldsets = [
|
|
(
|
|
None,
|
|
{
|
|
"classes": ["wide"],
|
|
"fields": ['username', 'email', 'password1', 'password2', 'umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id', ],
|
|
},
|
|
),
|
|
]
|
|
|
|
class CustomTeamRegistration(admin.ModelAdmin):
|
|
model = TeamRegistration
|
|
list_display = ['player_names', 'name']
|
|
|
|
admin.site.register(CustomUser, CustomUserAdmin)
|
|
admin.site.register(Club)
|
|
admin.site.register(Event)
|
|
admin.site.register(Round)
|
|
admin.site.register(GroupStage)
|
|
admin.site.register(Match)
|
|
admin.site.register(TeamScore)
|
|
admin.site.register(TeamRegistration, CustomTeamRegistration)
|
|
admin.site.register(Tournament)
|
|
admin.site.register(PlayerRegistration)
|
|
|