Last active
February 2, 2018 09:02
-
-
Save kezabelle/33a7f41643fc3e70da9452971e1e91a4 to your computer and use it in GitHub Desktop.
something like this maybe. for xref on #django
This file contains hidden or 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
| class Goaway(View): | |
| def dispatch(self, request, *args, **kwargs): | |
| try: | |
| resp = super(Goaway, self).dispatch(request, *args, **kwargs) | |
| except Http404 as e: | |
| return HttpResponseRedirect("/") | |
| def get_object(self, *args, **kwargs): | |
| obj = super(Goaway, self).get_object(*args, **kwargs) | |
| if obj.account_id != self.request.user.account_id: | |
| raise Http404("oof") | |
| return obj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment