[Django] #28995: Reuse django admin list view for model as a many to many selector

10 views
Skip to first unread message

Django

unread,
Jan 7, 2018, 3:31:41 PM1/7/18
to django-...@googlegroups.com
#28995: Reuse django admin list view for model as a many to many selector
-----------------------------------------+------------------------
Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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
[[Image(https://i.imgur.com/XCR1kMr.png)]]

2.
Reuse this list view from Question's Admin
[[Image(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?

--
Ticket URL: <https://code.djangoproject.com/ticket/28995>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 7, 2018, 5:23:54 PM1/7/18
to django-...@googlegroups.com
#28995: Reuse django admin list view for model as a many to many selector
-------------------------------+--------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by Dev Aggarwal):

* component: Uncategorized => contrib.admin
* ui_ux: 0 => 1
* type: Uncategorized => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/28995#comment:1>

Django

unread,
Jan 8, 2018, 10:29:42 AM1/8/18
to django-...@googlegroups.com
#28995: Reuse django admin list view for model as a many to many selector
-------------------------------+--------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => wontfix


Comment:

[https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/28995#comment:2>

Reply all
Reply to author
Forward
0 new messages