mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.8.x] Fixed #24302 -- Added DurationField.formfield()
Backport of 2d7c27d387 from master
This commit is contained in:
@@ -1692,6 +1692,13 @@ class DurationField(Field):
|
||||
val = self._get_val_from_obj(obj)
|
||||
return '' if val is None else duration_string(val)
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
defaults = {
|
||||
'form_class': forms.DurationField,
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return super(DurationField, self).formfield(**defaults)
|
||||
|
||||
|
||||
class EmailField(CharField):
|
||||
default_validators = [validators.validate_email]
|
||||
|
||||
Reference in New Issue
Block a user