Permalink
Browse files

Use permission_required decorator

  • Loading branch information...
1 parent b5a6ec4 commit 6516ec0f6f167c3ffe3110d21e174075fe9a83c0 @paltman paltman committed Feb 27, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 boxes/views.py
View
@@ -8,15 +8,16 @@
from django.utils import timezone
from django.views.decorators.http import require_POST
+from django.contrib.auth.decorators import permission_required
+
from boxes.forms import BoxForm
from boxes.models import Box
@require_POST
+@permission_required("boxes.change_box", raise_exception=True)
def box_edit(request, label):
- if not request.user.has_perm("boxes.change_box"):
- return HttpResponseForbidden()
next = request.GET.get("next")

0 comments on commit 6516ec0

Please sign in to comment.