-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from coredump-ch/member-list-access
Member list access
- Loading branch information
Showing
5 changed files
with
54 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from django.contrib.auth.decorators import login_required | ||
from django.utils.decorators import method_decorator | ||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin | ||
|
||
|
||
class LoginRequiredMixin: | ||
|
||
@method_decorator(login_required) | ||
def dispatch(self, *args, **kwargs): | ||
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs) | ||
class StaffRequiredMixin(UserPassesTestMixin, LoginRequiredMixin): | ||
""" | ||
Require login as staff. | ||
""" | ||
def test_func(self): | ||
return self.request.user.is_staff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters