a guest Feb 20th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def my_view(request, username):
- user = get_object_or_404(User, username = username)
- if user != request.user:
- return HttpRequestForbidden()
- def get_object(self, queryset=None):
- """ Hook to ensure object is owned by request.user. """
- obj = super(MyDeleteView, self).get_object()
- if not obj.owner == self.request.user:
- raise Http404
- return obj
RAW Paste Data