On 01/22/2018 06:03 PM, Anupam Jain wrote:
Wow - I just realised that we have been losing data for sometime on our
web platform since there were some fields in the ModelForm that were
hidden and not being sent. They were all being overwritten as blank
values. Thank God, we use django-reversion to track changes. Will take
us sometime to recover the data though.
Just something vaguely related that this post prompted in me ...
My general guide is... if you're using hidden fields, then you're
probably doing it wrong.
There are very few valid cases for passing data in hidden fields. In
most cases you really want to exclude the fields from the model. This
has the added benefit of protecting from a malicious user who edits the
values of the hidden fields.
A ModelForm will _only_ update fields on the model that it has fields
for. No matter what the user - or your code [such as clean functions] -
manages to get into the cleaned_data dict.
--
Curtis
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/f06e134e-f596-3938-0bdf-daea0a56d505%40tinbrain.net.
For more options, visit https://groups.google.com/d/optout.