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)
|
||||
|
||||
|
||||
class DateField(models.DateField, metaclass=models.SubfieldBase):
|
||||
def to_python(self, value):
|
||||
retval = super().to_python(value)
|
||||
if retval is not None:
|
||||
retval = Date.from_pydate(retval)
|
||||
return retval
|
||||
class DateField(models.DateField):
|
||||
def from_db_value(self, value, expression, connection, context):
|
||||
if value is not None:
|
||||
value = Date.from_pydate(value)
|
||||
return value
|
||||
|
||||
|
||||
class Payment(models.Model):
|
||||
|
|
Loading…
Reference in a new issue