Monday, May 8, 2017

field cannot be specified for model form as it is a non-editable field

Hi.

After upgrading to 1.11 I'm getting this error:

FieldError: created_at cannot be specified for <MyModel> model form as it is a non-editable field.

First of all, the model contains created_at field declared as DateTimeField(auto_now_add=True). Probably that's why it is non-editable. But I cannot set editable=True - the change has no effect.
My application allows overriding "created_at" value, because there are more than one separate input channels, and I have such cases. Other relies on auto_now_add. 

I want to leave auto_now_add=True as is, and have possibility to override it. 
How to achieve that? 

PS. Somebody asked me why I'm considering leaving Django, and this is a real example of worst changes in Django in last years. Breaking compatibility and blocking a dev to do what he want. There is nothing wrong with overriding such value.

Marcin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6f18a98-a197-49a1-8d64-8ec26861c028%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment