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 many to many relationship to sales_item. Therefore using inline formsets wouldn't be possible. I have tried it and inlines need foreign key.

What I am trying to achieve is to edit DealType like this:




Unlike the Many2Many widget, the one above is compatible to touch pads.

So I thought having an custom form that has a choiceField. I would feed the queryset of the choicefield with all entries of SalesItems. And the user can Add these forms (as part of the formset) and select which sales item to put in the deal.

Once I get in the request.POST I could see which ones are added and do a manual custom save on DealType class.

Is it now a bit more clear what I am trying to achieve?

Many Thanks,
Houman



On 16/08/12 22:47, Xavier Ordoquy wrote:
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: 
https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#inline-formsets

Regards,
Xavier Ordoquy,
Linovia.


--
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.

<<inline: ibdegijj.png>>

Reply via email to