Django: 'Model.fields' refers to field 'fieldname' that is missing from the form.

Weird, I'm certain that this field exists. Checking the model confirmed it. Look, its right there!

published = models.DateTimeField(auto_now_add = True)

Even after restarting the server and deleting *.pyc files, it still refuses to work.

'PromoAdmin.fields' refers to field 'published' that is missing from the form.

Exception Type: ImproperlyConfigured

Exception Value: 'ModelAdmin.fields' refers to field 'fieldname' that is missing from the form.

The solution? Simple. Remove "auto_now_add = True".

published = models.DateTimeField()

The validation of the form meant that fields that DateTimeField is values are automatically entered when added. With that reasoning, they are "read only" and are not displayed on the admin form.

[ Source ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog