Re: Django admin runs out of memory with ForeignKeys to large tables

2012-09-05 Thread Thomas Lockhart
On 9/5/12 6:00 AM, Mattias Linnap wrote: I've found two solutions: setting "editable=False" in the model's field definition (which removes the field completely from admin), or adding it to readonly_fields list in the ModelAdmin (which keeps the data visible). Perhaps it will be possible to subcl

Re: Django admin runs out of memory with ForeignKeys to large tables

2012-09-05 Thread m1chael
what about raw_id_fields ? On Wed, Sep 5, 2012 at 9:00 AM, Mattias Linnap wrote: > I've found two solutions: setting "editable=False" in the model's > field definition (which removes the field completely from admin), or > adding it to readonly_fields list in the ModelAdmin (which keeps the > dat

Re: Django admin runs out of memory with ForeignKeys to large tables

2012-09-05 Thread Mattias Linnap
I've found two solutions: setting "editable=False" in the model's field definition (which removes the field completely from admin), or adding it to readonly_fields list in the ModelAdmin (which keeps the data visible). Perhaps it will be possible to subclass ModelAdmin, and make all editable=False

Django admin runs out of memory with ForeignKeys to large tables

2012-09-05 Thread Mattias Linnap
Hi all, I have a model X that references another model Y with a ForeignKey. There are very few Xs, but close to a million Ys in the database (and it will grow considerably in the future). This causes MemoryErrors in the Django built-in admin pages: the ForeignKey is rendered as a select box field,