Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rights_needed(reguest):
- if request.user.groups.filter(Q(name='Admin')).exists():
- pass
- else:
- return HttpResponseRedirect('/account/log-in/')
- @method_decorator(right_needed, name='dispatch')
- class AdminView(CreateView):
- model = Admin
- form_class = AdminForm
- def get_template_names(self):
- return 'clinic/visitform_list.html'
- def dispatch(self, request):
- if request.user.groups.filter(Q(name='Admin')).exists():
- return super().dispatch(*args, **kwargs)
- else:
- return HttpResponseRedirect('/account/log-in/')
Add Comment
Please, Sign In to add comment