forked from rc/aircox
work on logs, timetable, stats
This commit is contained in:
@ -3,6 +3,8 @@ import datetime
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.urls.converters import StringConverter
|
||||
|
||||
from .utils import str_to_date
|
||||
|
||||
|
||||
class PagePathConverter(StringConverter):
|
||||
""" Match path for pages, including surrounding slashes. """
|
||||
@ -39,8 +41,7 @@ class DateConverter:
|
||||
regex = r'[0-9]{4}/[0-9]{2}/[0-9]{2}'
|
||||
|
||||
def to_python(self, value):
|
||||
value = value.split('/')
|
||||
return datetime.date(int(value[0]), int(value[1]), int(value[2]))
|
||||
return str_to_date(value)
|
||||
|
||||
def to_url(self, value):
|
||||
return '{:04d}/{:02d}/{:02d}'.format(value.year, value.month,
|
||||
|
Reference in New Issue
Block a user