+1 on "Roll your own" solution. Complicated M2Ms and Django Forms aren't always the cleanest pair of features to work with when combined.
On Fri, Aug 17, 2012 at 9:36 AM, houmie <hou...@gmail.com> wrote: > Thanks Melvyn, > > To be honest I would be willing to purchase a widget if there was one. iw > ill look into the list you have sent me. > > On another note, Simone mentioned to extend the Formset in order to run my > own dropdown solution. > > I was just looking at the modelformset_factory class and - surpise > surprise - it accepts a formfield_callback parameter, which could solve my > dilemma. > > I have used callbacks previously within a form to set localized to True: > > class CallsForm(ModelForm): > > def contact_date_callback(self, field, **kwargs) : > > return field.contact_date(localize=**True, **kwargs) > > > But I have no idea how to use it from view > > formset_type = modelformset_factory(**SalesItem, form=SalesItemFSForm, > extra=0, formfield_callback=???? ) > > > Do you happen to know how to use it? > > If I was able to set the queryset for the sales_item field in that > callback, I wouldn't have to extend the factory at all. > > > Many Thanks, > Houman > > > > > On 17/08/12 14:24, Melvyn Sopacua wrote: > >> On 17-8-2012 15:00, houmie wrote: >> >> Yes, I know about overriding a widget. I could override a Charfield with >>> a TextArea. For simple stuff it makes sense. >>> Against which widget do I override the existing M2M widget though? >>> >> If the one that Tomas linked doesn't work for you, you'll need to >> consult the roll-your-own department or keep looking around for >> different widgets, for example: >> <http://www.djangopackages.**com/grids/g/widgets/<http://www.djangopackages.com/grids/g/widgets/> >> > >> >> > -- > 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+unsubscribe@** > googlegroups.com <django-users%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en> > . > > -- 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.