mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-23 07:52:23 +00:00
Move aliases to inline admin
This commit is contained in:
parent
8a44f81d2c
commit
5172f74845
@ -2,8 +2,42 @@ from django.contrib import admin
|
||||
|
||||
from .models.notes import Alias, NoteClub, NoteSpecial, NoteUser
|
||||
|
||||
|
||||
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'
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Alias)
|
||||
admin.site.register(NoteClub)
|
||||
admin.site.register(NoteSpecial)
|
||||
admin.site.register(NoteUser)
|
||||
admin.site.register(NoteClub, NoteClubAdmin)
|
||||
admin.site.register(NoteSpecial, NoteSpecialAdmin)
|
||||
admin.site.register(NoteUser, NoteUserAdmin)
|
||||
|
@ -71,7 +71,7 @@ msgstr "note spéciale"
|
||||
|
||||
#: models/notes.py:85
|
||||
msgid "special notes"
|
||||
msgstr "notes spéciale"
|
||||
msgstr "notes spéciales"
|
||||
|
||||
#: models/notes.py:93 models/transactions.py:18
|
||||
msgid "name"
|
||||
|
18
note/migrations/0002_auto_20190716_1406.py
Normal file
18
note/migrations/0002_auto_20190716_1406.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.3 on 2019-07-16 12:06
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('note', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='noteclub',
|
||||
old_name='user',
|
||||
new_name='club',
|
||||
),
|
||||
]
|
@ -54,7 +54,7 @@ class NoteClub(Note):
|
||||
"""
|
||||
A Note associated to a Club
|
||||
"""
|
||||
user = models.OneToOneField(
|
||||
club = models.OneToOneField(
|
||||
'member.Club',
|
||||
on_delete=models.PROTECT,
|
||||
related_name='note',
|
||||
|
Loading…
Reference in New Issue
Block a user