2019-07-08 12:30:58 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2019-07-16 10:59:11 +00:00
|
|
|
from .models.notes import Alias, NoteClub, NoteSpecial, NoteUser
|
2019-07-16 07:05:30 +00:00
|
|
|
|
2019-07-16 12:38:52 +00:00
|
|
|
|
|
|
|
class AliasInlines(admin.TabularInline):
|
|
|
|
"""
|
|
|
|
Define user and club aliases when editing their note
|
|
|
|
"""
|
|
|
|
extra = 0
|
|
|
|
model = Alias
|
|
|
|
|
|
|
|
|
|
|
|
class NoteClubAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for NoteClub
|
|
|
|
"""
|
|
|
|
inlines = (AliasInlines,)
|
|
|
|
list_display = ('club', 'balance', 'is_active')
|
|
|
|
|
|
|
|
|
|
|
|
class NoteSpecialAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for NoteSpecial
|
|
|
|
"""
|
|
|
|
list_display = ('special_type', 'balance', 'is_active')
|
|
|
|
|
|
|
|
|
|
|
|
class NoteUserAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Admin customisation for NoteUser
|
|
|
|
"""
|
|
|
|
inlines = (AliasInlines,)
|
|
|
|
list_display = ('user', 'balance', 'is_active')
|
|
|
|
|
|
|
|
# Organize note by registration date
|
|
|
|
date_hierarchy = 'user__date_joined'
|
|
|
|
|
|
|
|
|
2019-07-08 12:30:58 +00:00
|
|
|
# Register your models here.
|
2019-07-16 12:38:52 +00:00
|
|
|
admin.site.register(NoteClub, NoteClubAdmin)
|
|
|
|
admin.site.register(NoteSpecial, NoteSpecialAdmin)
|
|
|
|
admin.site.register(NoteUser, NoteUserAdmin)
|