summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshen2018-02-07 14:45:28 +0530
committerGitHub2018-02-07 14:45:28 +0530
commit7b5d84beff749ac9bef2095908f5c505459c3351 (patch)
treed2b5312807ad276dc79e94547c1a8f0c9fc352b9
parentd6ec6dab5408dcf69275edb6a143c4f29654c90a (diff)
parent748e5573ff971f9a3b07a0b64fbe9e103f4abab0 (diff)
downloadworkshop_booking-7b5d84beff749ac9bef2095908f5c505459c3351.tar.gz
workshop_booking-7b5d84beff749ac9bef2095908f5c505459c3351.tar.bz2
workshop_booking-7b5d84beff749ac9bef2095908f5c505459c3351.zip
Merge pull request #36 from Akshen/develop
Format Dates while changing date of workshop
-rw-r--r--workshop_app/views.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/workshop_app/views.py b/workshop_app/views.py
index d0bf2e5..ea5d8d6 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -566,10 +566,14 @@ def my_workshops(request):
temp, iid = client_data[0].split("=")
temp, new_workshop_date = client_data[-2].split("%3D")
cid, workshop_title_id = client_data[1], client_data[2]
- workshop_date = client_data[3]
- today = datetime.today().date()
-
- if str(today) > new_workshop_date:
+ new_workshop_date = datetime.strptime(
+ new_workshop_date, "%Y-%m-%d"
+ )
+ workshop_date = datetime.strptime(
+ client_data[3], "%Y-%m-%d"
+ )
+ today = datetime.today()
+ if today > new_workshop_date:
return HttpResponse("Please Give proper Date!")
else:
result = RequestedWorkshop.objects.filter(
@@ -578,7 +582,6 @@ def my_workshops(request):
requested_workshop_title_id=workshop_title_id,
requested_workshop_date=workshop_date).update(
requested_workshop_date=new_workshop_date)
-
if result:
del temp
else: