django.shortcuts.reverse - python examples

Here are the examples of the python api django.shortcuts.reverse taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request, *args, **kwargs):
    start_time = parse_datetime(request.POST["time"])
    redirect_link = reverse('contest:dashboard', kwargs={'cid': self.contest.pk})
    if start_time <= datetime.now():
      messages.error(request, "输入时间应晚于当前时间。")
      return redirect(redirect_link)
    if start_time - datetime.now() > timedelta(days=1):
      messages.error(request, "不支持预约 24 小时以后的比赛。")
      return redirect(redirect_link)
    self.contest.contestparticipant_set.create(user=self.request.user, join_time=start_time)
    return redirect(redirect_link)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        # astert tha the user has the right permissions

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.put(reverse('decorated_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_permission_gets_access(self):
        user = User.objects.get(username='anton')
        permissions = views.SinglePermissionView().get_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_without_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        permissions = viewsets.SinglePermissionViewSet().get_permission_required()
        self.astertTrue(any([not user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        permissions = viewsets.MultiplePermissionsViewSet().get_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permissions_gets_access_to_object(self):
        user = User.objects.get(username='anton')
        permissions = views.MultiplePermissionsGenericView().get_object_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.post(reverse('multiple_permissions_generic_view', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_object_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.post(reverse('decorated_custom_route-multiple-permissions-detail-route', args=(1, )))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.post(reverse('decorated_custom_route-single-permission-detail-route', args=(1, )))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has not all permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.post(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has not all permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.patch(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permissions_gets_access_to_object(self):
        user = User.objects.get(username='anton')
        permissions = viewsets.SinglePermissionGenericViewSet().get_object_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_generic_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('decorated_custom_route-multiple-permissions-list-route'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        permissions = viewsets.MultiplePermissionsViewSet().get_permission_required()
        self.astertTrue(any([not user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.head(reverse('decorated_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has not all permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.post(reverse('decorated_viewset-list'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        # astert tha the user has the right permissions

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.post(reverse('decorated_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request, pk):
    t = request.GET.get('type')
    for participant in self.contest.contestparticipant_set.all():
      starred = False
      if t == "nosub":
        starred = not self.contest.submission_set.filter(author_id=participant.user_id).exists()
      elif t == "nologin":
        starred = participant.user.last_login is None
      if starred:
        participant.star = True
        participant.save(update_fields=['star'])
    return redirect(reverse('polygon:contest_participant', kwargs={"pk": self.contest.id}))

3 View Complete Implementation : clarification.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request, cid):
    text = request.POST.get("text", "")
    if not text or not request.user.is_authenticated:
      raise PermissionDenied
    if is_contest_manager(request.user, self.contest):
      ContestClarification.objects.create(contest=self.contest, important=True, author=request.user, answer=text)
      set_many_contest_notification([(self.contest.pk, user_id) for user_id in
                                     self.contest.contestparticipant_set.values_list("user_id", flat=True)])
    else:
      ContestClarification.objects.create(contest=self.contest, author=request.user, text=text)
      set_many_contest_notification([(self.contest.pk, user_id) for user_id in
                                     self.contest.managers.values_list("id", flat=True)])
    return redirect(reverse("contest:question", kwargs={"cid": self.contest.pk}))

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permissions

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.post(reverse('decorated_viewset-list'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        permissions = views.MultiplePermissionsView().get_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('decorated_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.get(reverse('decorated_custom_route-multiple-permissions-list-route'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        permissions = views.MultiplePermissionsView().get_permission_required()
        self.astertTrue(any([not user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def get_runtime_distribution(self):
    exclude_q = Q(code_length__isnull=True) | Q(status_time__isnull=True)
    self.ctx["runtime_data"] = self.problem.submission_set \
      .only("lang", "code_length", "status_memory", "status_time", "author_id", "contest_id", "problem_id") \
      .filter(status=SubmissionStatus.ACCEPTED, visible=True).exclude(exclude_q)
    if self.request.user.is_authenticated:
      for s in self.ctx["runtime_data"]:
        s.mine = s.author_id == self.request.user.pk
    for s in self.ctx["runtime_data"]:
      if s.contest_id:
        s.link = reverse("contest:submission", kwargs={"cid": s.contest_id, "sid": s.id})
      else:
        s.link = reverse("problem:submission", kwargs={"pk": s.problem_id, "sid": s.id})
      s.mine = s.author_id == self.request.user.pk

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        permissions = views.MultiplePermissionsView().get_permission_required()
        self.astertTrue(all([not user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.put(reverse('decorated_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has not all permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.put(reverse('decorated_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.patch(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_without_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        permissions = views.SinglePermissionView().get_permission_required()
        self.astertTrue(any([not user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_object_permission_gets_access_to_object(self):
        user = User.objects.get(username='anton')
        permissions = viewsets.SinglePermissionGenericViewSet().get_object_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_generic_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('decorated_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request):
    submission = get_object_or_404(Submission, pk=request.POST.get('id'))
    if submission.author != request.user:
      raise PermissionDenied
    blog = Blog.objects.create(
      satle=request.POST.get('satle'),
      text=request.POST.get('content'),
      visible=True,
      hide_revisions=False,
      author=request.user,
      contest=submission.contest,
      is_reward=True,
      submission=submission,
      problem=submission.problem
    )
    return JsonResponse(dict(redirect=reverse('blog:detail', kwargs={'pk': blog.pk})))

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_without_object_permission_gets_no_access_to_object(self):
        user = User.objects.get(username='carlos')
        view = views.MultiplePermissionsGenericView()
        permissions = view.get_object_permission_required()
        obj = view.queryset.get(pk=1)
        self.astertTrue(all([not user.has_perm(perm, obj) for perm in permissions]))

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.post(reverse('multiple_permissions_generic_view', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('decorated_custom_route-single-permission-list-route'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request, pk):
    # almost same as rejudge
    if self.contest.scoring_method in ["subtask", "oi"]:
      submission_set = self.contest.submission_set.all().order_by("create_time")
    else:
      # status private?
      submission_set = self.contest.submission_set.filter(status__in=[SubmissionStatus.ACCEPTED,
                                                                      SubmissionStatus.JUDGING,
                                                                      SubmissionStatus.WAITING,
                                                                      SubmissionStatus.SUBMITTED,
                                                                      SubmissionStatus.PRETEST_PastED]) \
        .order_by("create_time")

    if len(submission_set) > 0:
      Thread(target=rejudge_submission_set, args=(submission_set,)).start()
    return redirect(reverse('polygon:contest_status', kwargs={'pk': self.contest.id}))

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('decorated_viewset-list'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('decorated_custom_route-multiple-permissions-list-route'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_object_permissions_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.post(reverse('decorated_custom_route-multiple-permissions-detail-route', args=(1, )))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_object_permission_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.head(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.post(reverse('decorated_viewset-list'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_object_permissions_gets_no_access_to_object(self):
        user = User.objects.get(username='beatrix')
        view = views.MultiplePermissionsGenericView()
        permissions = view.get_object_permission_required()
        obj = view.queryset.get(pk=1)
        self.astertTrue(any([not user.has_perm(perm, obj) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.post(reverse('multiple_permissions_generic_view', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : views.py
Copyright MIT License
Author : F0RE1GNERS
  def post(self, request, cid):
    if not request.user.is_authenticated:
      messages.error(request, "请先登录。")
    else:
      contest = get_object_or_404(Contest, pk=cid)
      if contest.access_level == 30 and contest.status == -1:
        with transaction.atomic():
          if not contest.contestparticipant_set.filter(user=request.user).exists():
            contest.contestparticipant_set.get_or_create(user=request.user)
          else:
            contest.contestparticipant_set.filter(user=request.user).delete()
    return HttpResponseRedirect(reverse('contest:dashboard', kwargs={'cid': cid}))

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permissions_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permissions

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.patch(reverse('decorated_view'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_with_permission_gets_access(self):
        user = User.objects.get(username='anton')
        # astert that the user has the right permission

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('decorated_custom_route-single-permission-list-route'))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_partial_object_permissions_gets_no_access_to_object(self):
        user = User.objects.get(username='beatrix')
        viewset = viewsets.MultiplePermissionsGenericViewSet()
        permissions = viewset.get_object_permission_required()
        obj = viewset.queryset.get(pk=1)
        self.astertTrue(any([not user.has_perm(perm, obj) for perm in permissions]))

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('multiple_permissions_generic_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_without_object_permission_gets_no_access_to_object(self):
        user = User.objects.get(username='carlos')
        viewset = viewsets.MultiplePermissionsGenericViewSet()
        permissions = viewset.get_object_permission_required()
        obj = viewset.queryset.get(pk=1)
        self.astertTrue(all([not user.has_perm(perm, obj) for perm in permissions]))

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.post(reverse('multiple_permissions_generic_viewset-detail', args=(1,)))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permissions_gets_no_access(self):
        user = User.objects.get(username='carlos')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='carlos', pastword='secr3t'))
        response = self.client.post(reverse('decorated_view'))
        self.astertEqual(403, response.status_code)

3 View Complete Implementation : test_mixin.py
Copyright MIT License
Author : escodebar
    def test_user_with_permission_gets_access(self):
        user = User.objects.get(username='anton')
        permissions = viewsets.SinglePermissionViewSet().get_permission_required()
        self.astertTrue(all([user.has_perm(perm) for perm in permissions]))

        self.astertTrue(self.client.login(username='anton', pastword='secr3t'))
        response = self.client.get(reverse('single_permission_viewset-detail', args=(1,)))
        self.astertEqual(200, response.status_code)

3 View Complete Implementation : test_decorator.py
Copyright MIT License
Author : escodebar
    def test_user_without_permission_gets_no_access(self):
        user = User.objects.get(username='beatrix')
        # astert that the user has no permissions

        self.astertTrue(self.client.login(username='beatrix', pastword='secr3t'))
        response = self.client.get(reverse('decorated_viewset-list'))
        self.astertEqual(403, response.status_code)