A method for overriding default raw_id_fields behavior

70 views
Skip to first unread message

damon c

unread,
Jul 12, 2015, 2:18:24 PM7/12/15
to django-d...@googlegroups.com
The default behavior for the modelAdmin 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 as they will often experience a timeout.

I was thinking something like the following on admin.BaseModelAdmin might be helpful for people who would like to implement a different default behavior.

def get_raw_id_fields(self):

    """

    Hook for overriding default raw_id_fields behavior

    """

    return self.raw_id_fields

Anyone think this might a good idea?

Tim Graham

unread,
Jul 12, 2015, 9:04:10 PM7/12/15
to django-d...@googlegroups.com
Yes, there's an open ticket for that: https://code.djangoproject.com/ticket/17881
Reply all
Reply to author
Forward
0 new messages