coddingtonbear / django-measurement

Easily store, retrieve, and convert measurements of weight, volume, distance, area and more.
MIT License
145 stars 33 forks source link

Inline Formsets With Extra Rows Triggering has_changed #89

Open MidasJade opened 5 years ago

MidasJade commented 5 years ago

Curious if you've successfully used a MeasurementField with inline formsets? I can make a quick sample project if you like, but the TLDR version is that an extra row or an added row to an inline formset, where the row contains a MeasurementField, triggers has_changed (I'm thinking maybe when the dropdown is populated?) so the submitted form doesn't validate properly if it contains other required fields.

codingjoe commented 5 years ago

Hi @MidasJade,

Thanks for reaching out. I think I understand your problem, but you can help me help you, if you provide a small example. It will make the discussion less theoretical :)

Best -Joe

MidasJade commented 5 years ago

Joe,

Sorry for the delay. I've been traveling and haven't had time to get back to this. I ended up getting it to work by setting extra to 1 and max_num to 1, which only renders the extra row when adding and eliminates the need to check if a formset has changed. I'll do my best to create a small sample project at some point and post it here.

Thanks! -Chris