Clive Bruton
unread,Apr 1, 2021, 11:24:06 PM4/1/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
I have a ManyToMany model set, that on the edit uses a formset to add/
edit rows. I have this working, but the unfortunate part of it is
that the select that results from the ManyToMany relationship
populates with 16,000 records.
What I would like to do is, once the records are added, just have the
delete checkbox and show the 'description' field (uneditable) next to
it), and, rather than add records through a huge select list, add the
records by id.
To sketch it out, this is how it is:
<'Profile.directory-optin' checkbox>
<'Profile.directory-desc'>
<'Class.description' huge select>
<delete checkbox>
<!--hidden formset elements-->
<'Class.description' huge select>
<delete checkbox>
<!--hidden formset elements-->
<'Class.description' huge select>
<delete checkbox>
<!--hidden formset elements-->
<!--add new item-->
<'Class.description' huge select>
<delete checkbox>
<!--hidden formset elements-->
<save button>
And I'd rather it was something like:
<'Profile.directory-optin' checkbox>
<'Profile.directory-desc'>
<text of 'Class.description' field> <delete checkbox>
<!--hidden formset elements-->
<text of 'Class.description' field> <delete checkbox>
<!--hidden formset elements-->
<text of 'Class.description' field> <delete checkbox>
<!--hidden formset elements-->
<!--add new item-->
<new 'Class.id' text input field>
<!--does not need a 'delete' checkbox-->
<!--hidden formset elements-->
<save button>
The database tables look something like:
Profile Join table Class
======= ========== =====
id id id
directory-optin profile-id description
directory-desc class-id
Hope someone can help me out!
-- Clive