Implement middleware for admin views

- Add AdminMiddleware to deny non admin users
- Add decorator to mark views as "non admin"
This commit is contained in:
lispyclouds authored and Sunil Mohan Adapa committed 2017-02-15 20:57:52 +05:30
1 parent c8fb2c35c4
commit 3b23f78bdc
5 files changed
+125 -6

No files matched your search

+8 -1
View File
@@ -16,7 +16,7 @@
#
"""
Miscelleneous utility method.
Miscellaneous utility methods.
"""
import importlib
@@ -44,3 +44,10 @@ def _format_lazy(string, *args, **kwargs):
format_lazy = lazy(_format_lazy, str)
def non_admin_view(func):
"""Decorator to mark a view as non admin."""
setattr(func, "IS_NON_ADMIN", True)
return func