Take the 2-minute tour ×

I have a ModelForm based on a gigantic 300 fields model. Actually one model with 150 fields inheriting from another one with 150 other.

I was expecting the model to cause some issues at syncdb or save(), but it works fine.

However, calling the form based on this model as_p() method just take forever. I can wait 10 minutes without seen any output. Same for any HTML rendering method for this form. No error, just python hanging there wherever I'm in the shell or in the dev server.

Is there any known limitation or bug for hug forms in Django? Is there a workaround?

I'm suspecting some issue with string concatenation. I'm going to dig in the Django source code in the meantime, but if anybody got some clue that would save my day.

share|improve this question
have you tried just rendering one or a few fields from the model to see what happens? ({{form.field_name}}) –  second Dec 12 '11 at 17:09
This works fine. It must be one field specifically –  e-satis Dec 12 '11 at 17:22
keep adding fields until it breaks... –  second Dec 12 '11 at 17:24
Just did, found it. –  e-satis Dec 12 '11 at 17:25
add comment

2 Answers

if you have foreign keys to tables with a large number of rows, it's worth remembering that the default widget for each is a dropdown (<select>) with each row ('s unicode) as a choice. these often get enormous and it's worth looking at options (like the admin's raw_id_field)

share|improve this answer
That was my second guess, but that's not it. +1 anyway. –  e-satis Dec 12 '11 at 17:07
add comment

I found something like this in the code:

INCOME_CHOICES = tuple(zip(range(1, 1000000), range(1, 1000000)))


I guess there no more mystery :-)

share|improve this answer
Unless the number has to be exact why not tuple(zip(range(1, 1000000, 100), range(1, 1000000, 100))) Or use an html5 range widget from floppyforms. –  mtnpaul Dec 13 '11 at 10:39
I'll turn that into a simple char field, no beggy. –  e-satis Dec 13 '11 at 14:24
add comment

Your Answer


