summaryrefslogtreecommitdiff
path: root/workshop_app/views.py
diff options
context:
space:
mode:
authorpnshiralkar2020-05-18 20:26:40 +0530
committerpnshiralkar2020-05-18 20:26:40 +0530
commitdc96d20a777e03e590465c42a175d8d2154bf4d0 (patch)
tree19caa0f0e4433160cf2dcf195a6b108feedd382a /workshop_app/views.py
parent6620c14b338c989a610cae10bb9962f3fe550cbf (diff)
parent6f32060616b256546912cc8b29c9e9407839681b (diff)
downloadworkshop_booking-dc96d20a777e03e590465c42a175d8d2154bf4d0.tar.gz
workshop_booking-dc96d20a777e03e590465c42a175d8d2154bf4d0.tar.bz2
workshop_booking-dc96d20a777e03e590465c42a175d8d2154bf4d0.zip
Resolved merge conflicts, Base.html nav links fixed, removed redundant print statements
Diffstat (limited to 'workshop_app/views.py')
-rw-r--r--workshop_app/views.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 620020a..05ebf94 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -1,5 +1,6 @@
-from django.forms import inlineformset_factory, model_to_dict
from django.db.models import Q
+from django.forms import inlineformset_factory, model_to_dict
+from django.http import JsonResponse, Http404
from django.urls import reverse
try:
@@ -365,9 +366,6 @@ def workshop_type_details(request, workshop_type_id):
file.cleaned_data['id'].delete()
file.save()
return redirect(reverse('workshop_type_details', args=[form_data.id]))
- else:
- print(request.POST)
- print(form_file.errors)
else:
form = WorkshopTypeForm(instance=workshop_type)
form_file = AttachmentFileFormSet()
@@ -392,6 +390,16 @@ def delete_attachment_file(request, file_id):
return redirect(reverse('workshop_type_list'))
+@login_required
+def workshop_type_tnc(request, workshop_type_id):
+ workshop_type = WorkshopType.objects.filter(id=workshop_type_id)
+ if workshop_type.exists():
+ workshop_type = workshop_type.first()
+ return JsonResponse({'tnc': workshop_type.terms_and_conditions})
+ else:
+ raise Http404
+
+
def workshop_type_list(request):
"""Gives the details for types of workshops."""
user = request.user