Commit 5172f748 authored by erdnaxe's avatar erdnaxe 🎇

Move aliases to inline admin

parent 8a44f81d
Pipeline #1345 passed with stage
in 2 minutes and 20 seconds
......@@ -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"
......
# 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',
......
Markdown is supported
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