Login

Snippets by sebastien247

Snippet List

@group_required decorator

Use : `@group_required(('toto', 'titi'))` `def my_view(request):` `...` `@group_required('toto')` `def my_view(request):` `...` Note that group_required() also takes an optional login_url parameter `@group_required('toto', login_url='/loginpage/')` `def my_view(request):` `...` As in the login_required() decorator, login_url defaults to settings.LOGIN_URL. If the raise_exception parameter is given, the decorator will raise PermissionDenied, prompting the 403 (HTTP Forbidden) view instead of redirecting to the login page. Such as https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-permission-required-decorator **Inspired by** : https://github.com/django/django/blob/stable/1.8.x/django/contrib/auth/decorators.py

  • decorator
  • login
  • auth
  • decorators
  • group_required
  • @group_required
Read More

sebastien247 has posted 1 snippet.