1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-12-13 23:05:16 +01:00

Implement signals

This commit is contained in:
Alexandre Iooss
2019-07-19 15:00:44 +02:00
parent d957e643c9
commit 085cd90a7f
5 changed files with 111 additions and 22 deletions

View File

@@ -119,6 +119,16 @@ class TransactionAdmin(admin.ModelAdmin):
poly_destination.short_description = _('destination')
def get_readonly_fields(self, request, obj=None):
"""
Only valid can be edited after creation
Else the amount of money would not be transferred
"""
if obj: # user is editing an existing object
return 'created_at', 'source', 'destination', 'quantity',\
'amount', 'transaction_type'
return []
@admin.register(TransactionTemplate)
class TransactionTemplateAdmin(admin.ModelAdmin):