added timezone to workout model
This commit is contained in:
@@ -3,6 +3,7 @@ import colorsys
|
||||
import timestring
|
||||
import zipfile
|
||||
import bleach
|
||||
import pytz
|
||||
import operator
|
||||
import warnings
|
||||
import urllib
|
||||
@@ -6255,6 +6256,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
duration = form.cleaned_data['duration']
|
||||
distance = form.cleaned_data['distance']
|
||||
notes = form.cleaned_data['notes']
|
||||
thetimezone = form.cleaned_data['timezone']
|
||||
try:
|
||||
boattype = request.POST['boattype']
|
||||
except KeyError:
|
||||
@@ -6272,6 +6274,9 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
startdatetime = datetime.datetime.strptime(startdatetime,
|
||||
"%Y-%m-%d %H:%M:%S")
|
||||
startdatetime = timezone.make_aware(startdatetime)
|
||||
startdatetime = startdatetime.astimezone(pytz.timezone(thetimezone))
|
||||
print startdatetime
|
||||
|
||||
# check if user is owner of this workout
|
||||
if checkworkoutuser(request.user,row):
|
||||
row.name = name
|
||||
@@ -6285,6 +6290,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
row.boattype = boattype
|
||||
row.privacy = privacy
|
||||
row.rankingpiece = rankingpiece
|
||||
row.timezone = thetimezone
|
||||
try:
|
||||
row.save()
|
||||
except IntegrityError:
|
||||
|
||||
Reference in New Issue
Block a user