Attribute Error 'module' Object Has No Attribute 'datefield'
I'm trying to extend an admin definition in Satchmo/Django and am getting the error 'Attribute Error 'module' object has no attribute 'DateField'' trying to add a formfield_overrid
Solution 1:
DateField
is defined in django.db.models
, notdjango.forms.models
. You need to import django.db.models
as well.
Perhaps use:
from django.dbimport models as db_models
formfield_overrides = {
db_models.DateField: {
'widget': AdminDateWidget,
'input_formats': settings.VALID_DATE_FORMATS,
},
}
Post a Comment for "Attribute Error 'module' Object Has No Attribute 'datefield'"