Hello fellow Django Users!
I’ve been facing some issues with form validation. And it completely makes sense. But I hope some of you people could help me. Let me (try) to explain.
There is a model:
-Not managed by me;
-With no id but unique_together;
I have to use this model as a field. ModelChoiceField works as a charm. It renders ok with some tweaking on the str function. But validation (trough form.is_valid()) turns out to be impossible given that the instance referred in request.POST is not a composite of the unique fields, but the first field of the model, and a MultipleObjectsReturned error is raised. Although understanding the problem itself is not a issue (at least for me, I hope I made the problem clear also for you, fellow Django User) I’m struggling to even come up with some workaround that does not involve create an id field.
Is it possible to set the value of the instance as a composite? Will it be queryed right? What should I do?
Thanks in advance for any insight.