[Django] #25114: ModelAdmin FK fields should default to raw_id

9 views
Skip to first unread message

Django

unread,
Jul 12, 2015, 1:16:59 PM7/12/15
to django-...@googlegroups.com
#25114: ModelAdmin FK fields should default to raw_id
-------------------------------+--------------------
Reporter: vepkenez | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Foreign key fields in the admin currently default to a behavior that can
cause crashing and user inconvenience.

The default behavior is to render a <select> element containing ''every''
instance of the model referred to by the FK.

When this field refers to a model that has for example, 100,000 or more
entries, this can have the affect of crashing a server, a browser, or at
best making new users confused about why they cannot view the admin page
for this instance.

Defaulting to raw_id is safer and more reliable in most cases and presents
minimal compromises in usability (in my opinion).

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

Django

unread,
Jul 12, 2015, 1:17:53 PM7/12/15
to django-...@googlegroups.com
#25114: ModelAdmin FK fields should default to raw_id
-------------------------------+--------------------------------------

Reporter: vepkenez | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------+--------------------------------------
Changes (by vepkenez):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> Foreign key fields in the admin currently default to a behavior that can
> cause crashing and user inconvenience.
>
> The default behavior is to render a <select> element containing ''every''
> instance of the model referred to by the FK.
>
> When this field refers to a model that has for example, 100,000 or more
> entries, this can have the affect of crashing a server, a browser, or at
> best making new users confused about why they cannot view the admin page
> for this instance.
>
> Defaulting to raw_id is safer and more reliable in most cases and
> presents minimal compromises in usability (in my opinion).

New description:

Foreign key fields in the admin currently default to a behavior that can

cause crashes and user inconvenience.

The default behavior is to render a <select> element containing ''every''
instance of the model referred to by the FK.

When this field refers to a model that has for example, 100,000 or more
entries, this can have the affect of crashing a server, a browser, or at
best making new users confused about why they cannot view the admin page
for this instance.

Defaulting to raw_id is safer and more reliable in most cases and presents
minimal compromises in usability (in my opinion).

--

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

Django

unread,
Jul 12, 2015, 1:27:13 PM7/12/15
to django-...@googlegroups.com
#25114: ModelAdmin FK fields should default to raw_id
-------------------------------------+-------------------------------------
Reporter: vepkenez | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------------+-------------------------------------
Changes (by vepkenez):

* type: Uncategorized => Cleanup/optimization


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

Django

unread,
Jul 12, 2015, 1:30:18 PM7/12/15
to django-...@googlegroups.com
#25114: ModelAdmin FK fields should default to raw_id
-------------------------------------+-------------------------------------
Reporter: vepkenez | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

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


Comment:

I don't think the justification is strong enough to warrant a backwards
incompatible change here (i.e. every Django project would have to switch
from opting-in to `raw_id_fields` to opting-out), but feel free to open a
discussion on the DevelopersMailingList if you want to try to get a
consensus otherwise.

--
Ticket URL: <https://code.djangoproject.com/ticket/25114#comment:3>

Django

unread,
Jul 12, 2015, 1:48:43 PM7/12/15
to django-...@googlegroups.com
#25114: A way to change default raw_id_fields behavior
-------------------------------------+-------------------------------------
Reporter: vepkenez | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------------+-------------------------------------

Old description:

> Foreign key fields in the admin currently default to a behavior that can

> cause crashes and user inconvenience.


>
> The default behavior is to render a <select> element containing ''every''
> instance of the model referred to by the FK.
>
> When this field refers to a model that has for example, 100,000 or more
> entries, this can have the affect of crashing a server, a browser, or at
> best making new users confused about why they cannot view the admin page
> for this instance.
>
> Defaulting to raw_id is safer and more reliable in most cases and
> presents minimal compromises in usability (in my opinion).

New description:

Foreign key fields in the admin currently default to a behavior that can

cause crashes and user inconvenience.

The default behavior is to render a <select> element containing ''every''
instance of the model referred to by the FK.

When this field refers to a model that has for example, 100,000 or more
entries, this can have the affect of crashing a server, a browser, or at
best making new users confused about why they cannot view the admin page
for this instance.

A get_raw_id_fields method that enables

--

Comment (by vepkenez):

You are totally right about this. I was just here to propose an alternate
solution to this but I will start a discussion on the dev mailing list.

something like this...
{{{
def get_raw_id_fields(self):
"""
Hook for overriding default raw_id_fields behavior
"""
return self.raw_id_fields
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25114#comment:4>

Django

unread,
Jul 12, 2015, 1:57:50 PM7/12/15
to django-...@googlegroups.com
#25114: A way to change default raw_id_fields behavior
-------------------------------------+-------------------------------------
Reporter: vepkenez | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

There's an open ticket about adding `get_raw_id_fields()`: #17881.

--
Ticket URL: <https://code.djangoproject.com/ticket/25114#comment:5>

Django

unread,
Jul 12, 2015, 2:00:06 PM7/12/15
to django-...@googlegroups.com
#25114: A way to change default raw_id_fields behavior
-------------------------------------+-------------------------------------
Reporter: vepkenez | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 1.8
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: 0
-------------------------------------+-------------------------------------

Comment (by vepkenez):

so sorry. I really did look for this!
Ok great!

--
Ticket URL: <https://code.djangoproject.com/ticket/25114#comment:6>

Reply all
Reply to author
Forward
0 new messages