mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
Format code
This commit is contained in:
@ -25,7 +25,10 @@ class NoteAdmin(PolymorphicParentModelAdmin):
|
||||
Parent regrouping all note types as children
|
||||
"""
|
||||
child_models = (NoteClub, NoteSpecial, NoteUser)
|
||||
list_filter = (PolymorphicChildModelFilter, 'is_active',)
|
||||
list_filter = (
|
||||
PolymorphicChildModelFilter,
|
||||
'is_active',
|
||||
)
|
||||
|
||||
# Use a polymorphic list
|
||||
list_display = ('pretty', 'balance', 'is_active')
|
||||
@ -44,11 +47,12 @@ class NoteClubAdmin(PolymorphicChildModelAdmin):
|
||||
"""
|
||||
Child for a club note, see NoteAdmin
|
||||
"""
|
||||
inlines = (AliasInlines,)
|
||||
inlines = (AliasInlines, )
|
||||
|
||||
# We can't change club after creation or the balance
|
||||
readonly_fields = ('club', 'balance')
|
||||
search_fields = ('club',)
|
||||
search_fields = ('club', )
|
||||
|
||||
def has_add_permission(self, request):
|
||||
"""
|
||||
A club note should not be manually added
|
||||
@ -67,7 +71,7 @@ class NoteSpecialAdmin(PolymorphicChildModelAdmin):
|
||||
"""
|
||||
Child for a special note, see NoteAdmin
|
||||
"""
|
||||
readonly_fields = ('balance',)
|
||||
readonly_fields = ('balance', )
|
||||
|
||||
|
||||
@admin.register(NoteUser)
|
||||
@ -75,7 +79,7 @@ class NoteUserAdmin(PolymorphicChildModelAdmin):
|
||||
"""
|
||||
Child for an user note, see NoteAdmin
|
||||
"""
|
||||
inlines = (AliasInlines,)
|
||||
inlines = (AliasInlines, )
|
||||
|
||||
# We can't change user after creation or the balance
|
||||
readonly_fields = ('user', 'balance')
|
||||
@ -101,7 +105,10 @@ class TransactionAdmin(admin.ModelAdmin):
|
||||
list_display = ('created_at', 'poly_source', 'poly_destination',
|
||||
'quantity', 'amount', 'transaction_type', 'valid')
|
||||
list_filter = ('transaction_type', 'valid')
|
||||
autocomplete_fields = ('source', 'destination',)
|
||||
autocomplete_fields = (
|
||||
'source',
|
||||
'destination',
|
||||
)
|
||||
|
||||
def poly_source(self, obj):
|
||||
"""
|
||||
@ -136,8 +143,8 @@ class TransactionTemplateAdmin(admin.ModelAdmin):
|
||||
Admin customisation for TransactionTemplate
|
||||
"""
|
||||
list_display = ('name', 'poly_destination', 'amount', 'template_type')
|
||||
list_filter = ('template_type',)
|
||||
autocomplete_fields = ('destination',)
|
||||
list_filter = ('template_type', )
|
||||
autocomplete_fields = ('destination', )
|
||||
|
||||
def poly_destination(self, obj):
|
||||
"""
|
||||
@ -153,5 +160,5 @@ class TransactionCategoryAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
Admin customisation for TransactionTemplate
|
||||
"""
|
||||
list_display = ('name',)
|
||||
list_filter = ('name',)
|
||||
list_display = ('name', )
|
||||
list_filter = ('name', )
|
||||
|
Reference in New Issue
Block a user