+ def get_context_data(self, **kwargs):
+ c = super().get_context_data(**kwargs)
+ c['club'] = models.Club.objects.first()
+ return c
+
+
+def set_monthly(request, key):
+ schedule = get_object_or_404(models.Schedule, payed_at=None, key=key)
+ if request.POST:
+ schedule.monthly = request.POST.get('monthly') == 'true'
+ schedule.save(update_fields=['monthly'])
+ return JsonResponse({
+ "amount": schedule.amount,
+ "monthly": schedule.monthly,
+ })
+