def decorated(request, *args, **kwargs): user = request.user if user.is_authenticated(): profile, is_new = user.get_profile(return_is_new=True) siteconfig = SiteConfiguration.objects.get_current() if (siteconfig.get('privacy_enable_user_consent') and not (callable(disable_consent_checks) and disable_consent_checks(request)) and (is_new or is_consent_missing(user))): return HttpResponseRedirect( '%s?next=%s' % (local_site_reverse('user-preferences', request=request), quote(request.get_full_path()))) return view_func(request, *args, **kwargs)
def decorated(request, *args, **kwargs): user = request.user if user.is_authenticated(): profile, is_new = Profile.objects.get_or_create(user=user) siteconfig = SiteConfiguration.objects.get_current() if (siteconfig.get('privacy_enable_user_consent') and not (callable(disable_consent_checks) and disable_consent_checks(request)) and (is_new or is_consent_missing(user))): return HttpResponseRedirect( '%s?next=%s' % (local_site_reverse('user-preferences', request=request), quote(request.get_full_path())) ) return view_func(request, *args, **kwargs)
def is_user_missing_consent(self): """Whether or not the user is missing consent.""" return is_consent_missing(self.request.user)