Also allow slashes as separator in date fields

This commit is contained in:
Matthias Kiefer 2014-10-27 10:27:56 +01:00
parent 50ef028a97
commit 2658edbd5f

View file

@ -1088,11 +1088,11 @@ class DateField(MediaField):
year, month, and day number. Each number is either an integer or
None.
"""
# Get the underlying data and split on hyphens.
# Get the underlying data and split on hyphens and slashes.
datestring = super(DateField, self).__get__(mediafile, None)
if isinstance(datestring, basestring):
datestring = re.sub(r'[Tt ].*$', '', unicode(datestring))
items = unicode(datestring).split('-')
items = re.split('-|/', unicode(datestring))
else:
items = []