Opened 7 years ago

Closed 7 years ago

#28995 closed New feature (wontfix)

Reuse django admin list view for model as a many to many selector

Reported by: Dev Aggarwal Owned by: nobody
Component: contrib.admin Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Hello, I have some models defined like so

class Question(models.Model):
    ...
    question_image = models.ImageField(default='')

class Exam(models.Model):
    ...     
    questions = models.ManyToManyField(Question)

Now, I am looking for a way to make it more sensible to select questions in the Exam Admin

Here is what I think should be pretty manageable

1.
Have a link to open a separate question selection page in Exam change Admin
https://i.imgur.com/XCR1kMr.png

2.
Reuse this list view from Question's Admin
https://i.imgur.com/QaGz5VM.png

Since it already has checkbox and the images are displayed too,
All i need is a Submit button and some JS after i have stripped it down to fit my needs.

Can you please guide me on how i should properly reuse that question list view?

Change History (2)

comment:1 by Dev Aggarwal, 7 years ago

Component: Uncategorizedcontrib.admin
Type: UncategorizedNew feature
UI/UX: set

comment:2 by Tim Graham, 7 years ago

Resolution: wontfix
Status: newclosed

ModelAdmin.raw_id_fields allows using the list view to select items. I don't think we should further complicate the standard select by adding the "Open select dialog" button proposed in the screenshot. You can write a custom widget for that if you want that, but this isn't the place to get answers about how to implement it. See TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top