Request for closing #25139 -- ModelFormSet: allow swapping unique values

59 views
Skip to first unread message

PARTH PATIL

unread,
Aug 11, 2019, 3:20:49 AM8/11/19
to Django developers (Contributions to Django itself)
Hey can someone please have look at this ticket, I feel the requested feature is not really feasible to implement, also it's not applicable in the general case.

I don't think so this is feasible, this will require n(n-1)/2 comparisons to determine whether any two of the models are swapped.
This looks easy in the above case but won't be a good idea for a general case.

Correct me if I'm wrong or if anyone has a better approach for implementation of this feature. I would like to work on it.

But as of now, I feel this ticket should be closed


Here is a link to the ticket

Carlton Gibson

unread,
Aug 15, 2019, 5:43:23 AM8/15/19
to Django developers (Contributions to Django itself)
Hi Parth. 

Thanks for looking at this. I think you're right that there's no (suitably obvious at least to me) simple way of solving this. I guess that's why it's sat there for 4 years. 🙂

What would it take: fetching the set of to_be_unique values and comparing it to the set of values submitted and then assigning both within a transaction... — meh, possible but I'm not sure it'd be clean, or something we'd want to bundle in even if we had the solution available, vs, putting it in a third-party package...

Anyhow, I'll bump it to Someday/Maybe for now. If someone pops up with a solution we can look at that then. 

Kind Regards,

Carlton

PARTH PATIL

unread,
Aug 15, 2019, 7:52:16 AM8/15/19
to Django developers (Contributions to Django itself)
Yup sounds right. 
Reply all
Reply to author
Forward
0 new messages