More donation form fixes.
[wolnelektury.git] / src / club / views.py
index a55f284..503a431 100644 (file)
@@ -30,6 +30,7 @@ class ClubView(TemplateView):
 
 
 
+@method_decorator(never_cache, name='dispatch')
 class DonationStep1(UpdateView):
     queryset = models.Schedule.objects.filter(payed_at=None)
     form_class = forms.DonationStep1Form
@@ -46,6 +47,7 @@ class DonationStep1(UpdateView):
         return reverse('donation_step2', args=[self.object.key])
 
 
+@method_decorator(never_cache, name='dispatch')
 class DonationStep2(UpdateView):
     queryset = models.Schedule.objects.filter(payed_at=None)
     form_class = forms.DonationStep2Form
@@ -62,7 +64,7 @@ class DonationStep2(UpdateView):
 def set_monthly(request, key):
     schedule = get_object_or_404(models.Schedule, payed_at=None, key=key)
     if request.POST:
-        schedule.monthly = True
+        schedule.monthly = request.POST.get('monthly') == 'true'
         schedule.save(update_fields=['monthly'])
     return JsonResponse({
         "amount": schedule.amount,