On May 27, 9:55 am, nbv4 <cp368...@ohio.edu> wrote:
> I have a model which has about 4 fields. One of those fields is a
> foreign key to another model which has over 40,000 objects in the
> database. When I create a 'stock' ModelForm of this model, and display
> it in a template, it wants to create a <select> with 40,000 items. I
> have created a custom ModelForm for this model that overrides that
> select box and uses a plain "raw_is" textbox instead.
>
> The problem is if I want to make a modelformset of this model, I am
> stuck using the 'stock' ModelForm for that model, instead of using my
> tricked out ModelForm I created that has the overridden widget. I
> either have to deal with 10 or so select boxes with 40,000 options, or
> manually write code to create and save all 10 model forms. My question
> is why is this? Is this something that has just been overlooked, or is
> there some deeper reason why this is so?

What makes you think you are stuck with the 'stock' ModelForm?

modelformset_factory takes a 'form' parameter, allowing you to pass in
your overridden form class.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to