Mohamed Feddad

36%
Flag icon
Staff members in Django are users with the is_staff flag set in the user model. Here you can use a built-in mixin called UserPassesTestMixin, as follows: from django.contrib.auth.mixins import UserPassesTestMixin     class SomeStaffView(UserPassesTestMixin, TemplateView):     def test_func(self, user):         return user.is_staff
Django Design Patterns and Best Practices: Industry-standard web development techniques and solutions using Python, 2nd Edition
Rate this book
Clear rating
Open Preview