def upload_media(request): """Upload media view""" from allauth.account.forms import LoginForm form = LoginForm() context = {} context["form"] = form context["can_add"] = user_allowed_to_upload(request) can_upload_exp = settings.CANNOT_ADD_MEDIA_MESSAGE context["can_upload_exp"] = can_upload_exp return render(request, "cms/add-media.html", context)
def dispatch(self, request, *args, **kwargs): if not user_allowed_to_upload(request): raise PermissionDenied # HTTP 403 return super(FineUploaderView, self).dispatch(request, *args, **kwargs)