[1] https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields
On April 1, 2021 10:23:03 PM CDT, Clive Bruton <clive@indx.co.uk> wrote:
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
No comments:
Post a Comment