15👍
✅
created_at = models.DateTimeField(default=datetime.now, editable=False)
updated_at = models.DateTimeField(auto_now=True)
http://docs.djangoproject.com/en/dev/ref/models/fields/#editable
Field.editable
If False, the field will not be
editable in the admin or via forms
automatically generated from the model
class. Default is True.
also
Note
As currently implemented, setting
auto_now or auto_now_add to True will
cause the field to have editable=False
and blank=True set.
0👍
If your indentation matches the excerpt above, then you may need to properly nest that Meta
subclass inside BaseModel
. Otherwise, django will try doing multi-table inheritance–but that should still work with what you’re trying to do (unless you have a non-standard setup, e.g. django-nonrel).
What code is triggering this exception, just importing the module?
Source:stackexchange.com