def signup(self, request, user): if self.cleaned_data['import_ratings']: ratings = get_anonymous_ratings(request.session) clear_anonymous_ratings(request.session) Rating.objects.bulk_create([ Rating(user=user, work_id=work_id, choice=choice) for work_id, choice in ratings.items() ])
def signup(self, request, user): if self.cleaned_data['import_ratings']: ratings = get_anonymous_ratings(request.session) clear_anonymous_ratings(request.session) Rating.objects.bulk_create([ Rating(user=user, work_id=work_id, choice=choice) for work_id, choice in ratings.items() ]) Profile.objects.filter(id=user.profile.pk).update( newsletter_ok=self.cleaned_data['newsletter_ok'], research_ok=self.cleaned_data['research_ok'])
def remove_all_anon_ratings(request): if request.method == 'POST': clear_anonymous_ratings(request.session) return redirect('home') else: raise Http404