race edit form
This commit is contained in:
@@ -7,7 +7,7 @@ import time
|
||||
from django.db import IntegrityError
|
||||
import uuid
|
||||
from django.conf import settings
|
||||
|
||||
import pytz
|
||||
from utils import myqueue
|
||||
|
||||
import django_rq
|
||||
@@ -447,3 +447,37 @@ def update_plannedsession(ps,cd):
|
||||
ps.save()
|
||||
|
||||
return 1,'Planned Session Updated'
|
||||
|
||||
def update_virtualrace(ps,cd):
|
||||
for attr, value in cd.items():
|
||||
if attr == 'comment':
|
||||
value.replace("\r\n", "
");
|
||||
value.replace("\n", "
");
|
||||
setattr(ps, attr, value)
|
||||
|
||||
# correct times
|
||||
|
||||
course = cd['course']
|
||||
geocourse = GeoCourse.objects.get(id= course.id)
|
||||
timezone_str = courses.get_course_timezone(geocourse)
|
||||
|
||||
startdatetime = datetime.combine(cd['startdate'],cd['start_time'])
|
||||
enddatetime = datetime.combine(cd['enddate'],cd['end_time'])
|
||||
|
||||
startdatetime = pytz.timezone(timezone_str).localize(
|
||||
startdatetime
|
||||
)
|
||||
enddatetime = pytz.timezone(timezone_str).localize(
|
||||
enddatetime
|
||||
)
|
||||
ps.evaluation_closure = pytz.timezone(timezone_str).localize(
|
||||
ps.evaluation_closure.replace(tzinfo=None)
|
||||
)
|
||||
ps.registration_closure = pytz.timezone(timezone_str).localize(
|
||||
ps.registration_closure.replace(tzinfo=None)
|
||||
)
|
||||
|
||||
|
||||
ps.save()
|
||||
|
||||
return 1,'Virtual Race Updated'
|
||||
|
||||
Reference in New Issue
Block a user