From cd3d306df80adc419f4258e584441340df92e6c6 Mon Sep 17 00:00:00 2001 From: Niklas Brachmann Date: Sun, 16 Aug 2015 19:20:43 +0200 Subject: [PATCH] Disabled manual creation of accounts --- cashonly/admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cashonly/admin.py b/cashonly/admin.py index d844933..532e03f 100644 --- a/cashonly/admin.py +++ b/cashonly/admin.py @@ -46,6 +46,11 @@ class AccountAdmin(admin.ModelAdmin): }), ) + # Disable manual creation of accounts. + # Accounts are create after user creation automatically. + def has_add_permission(self, request): + return False + def transaction_link(self, account): return '%s' % \ (reverse("admin:cashonly_transaction_changelist"), account.id, @@ -111,7 +116,10 @@ class SalesLogEntryAdmin(admin.ModelAdmin): class TransactionAdmin(admin.ModelAdmin): list_display = ('account', 'timestamp', 'subject', 'description', 'amount') list_filter = ['account', 'timestamp', 'subject'] + + # Disable mass deletion in the overview page actions = None + date_hierarchy = 'timestamp' # Disable tampering with the transactions completely.