models: Update DateField to use Django 1.10 method.
This commit is contained in:
parent
a82ebfb0a9
commit
271f7a8c5b
1 changed files with 5 additions and 6 deletions
|
@ -54,12 +54,11 @@ class Date(datetime.date):
|
||||||
return self.adjust_month(1, day=1)
|
return self.adjust_month(1, day=1)
|
||||||
|
|
||||||
|
|
||||||
class DateField(models.DateField, metaclass=models.SubfieldBase):
|
class DateField(models.DateField):
|
||||||
def to_python(self, value):
|
def from_db_value(self, value, expression, connection, context):
|
||||||
retval = super().to_python(value)
|
if value is not None:
|
||||||
if retval is not None:
|
value = Date.from_pydate(value)
|
||||||
retval = Date.from_pydate(retval)
|
return value
|
||||||
return retval
|
|
||||||
|
|
||||||
|
|
||||||
class Payment(models.Model):
|
class Payment(models.Model):
|
||||||
|
|
Loading…
Reference in a new issue