From cdcbbaea50438faa14771ee5e716f5ee71180ae3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 10 Oct 2012 14:59:48 +0200 Subject: [PATCH] Handle permissions in migdal admin. --- migdal/admin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/migdal/admin.py b/migdal/admin.py index 5c01f74..6bdfb59 100644 --- a/migdal/admin.py +++ b/migdal/admin.py @@ -21,6 +21,15 @@ def filtered_entry_admin(typ): def queryset(self, request): return self.model.objects.filter(type=typ) + def has_add_permission(self, request): + return request.user.has_perm('migdal.add_entry') + + def has_change_permission(self, request, obj=None): + return request.user.has_perm('migdal.change_entry') + + def has_delete_permission(self, request, obj=None): + return request.user.has_perm('migdal.delete_entry') + date_hierarchy = 'date' readonly_fields = ('date', 'changed_at') + \ translated_fields(('published_at',)) -- 2.20.1