Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-18 Thread Melvyn Sopacua
On 17-8-2012 0:05, houmie wrote: > DealType class has a many to many relationship to sales_item. Therefore > using inline formsets wouldn't be possible. I have tried it and inlines > need foreign key. You *can* use the reverse bit of a ManyToManyField with inline formsets. The information on

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Kurtis Mullins
+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 wrote: > Thanks Melvyn, > > To be honest I would be willing to purchase a widget if there was one.

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie
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 -

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Melvyn Sopacua
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

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie
Thanks Melvyn, 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? On 17/08/12 01:01, Melvyn Sopacua wrote: On 17-8-2012 1:05, Houman wrote: What I am

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie
Thanks Thomas. Just trying to apply the DropDownMultiple Widget that you have suggested. I have followed the instruction: |class MyForm(forms.ModelForm): categories = forms.Field(widget=DropDownMultiple) def __init__(self, *args, **kwargs):

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Simone Federici
On 16/ago/2012, at 23:35, Houmie wrote: > The question might seem too simplistic, but it seems formsets can only work > with forms that have simple type fields such as charfield. > But has anyone tried to use a form with a dropdown and use that form to > instantiate a

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Tomas Neme
DropDownMultiple widget http://djangosnippets.org/snippets/747/ -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_(") to help him gain world domination. --

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Melvyn Sopacua
On 17-8-2012 1:05, Houman wrote: > What I am trying to achieve would be deal type having a m2m > relationship to sales items. I don't like the m2m widget, So change it. All ModelForm derivatives have a widgets argument that is a dictionary of fieldname => widget instance:

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Houman
Hi xavier, Apologies for the confusion. What I am trying to achieve would be deal type having a m2m relationship to sales items. I don't like the m2m widget, so I thought I use formsets with dropdowns in them. The idea is good, somce the user would choose how many dropdowns he wants and

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Xavier Ordoquy
Hi Houman Le 17 août 2012 à 00:05, houmie a écrit : > DealType class has a many to many relationship to sales_item. Therefore > using inline formsets wouldn't be possible. I have tried it and inlines need > foreign key. DealType has a ForeignKey to Company which is what

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread houmie
Hi Xavier, This wasn't the whole story. I actually have a DealType class: |class DealType(models.Model): deal_name= models.CharField(max_length=40) sales_item= models.ManyToManyField(SalesItem) price= models.DecimalField(decimal_places=2) | DealType class has a

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Xavier Ordoquy
Hi, I'm not sure I understood what you're trying to do. If you want to display all the SaleItem linked to a company in a formset, then inlines are what you're looking for. You'll find the documentation about them there:

How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Houmie
The question might seem too simplistic, but it seems formsets can only work with forms that have simple type fields such as charfield. But has anyone tried to use a form with a dropdown and use that form to instantiate a formset? Let me give you an example why this fails: *Model:* class