Wednesday, June 23, 2010

trouble with many to many form

Hi all. I'm new to django. Help me pls.

Situation:

Need form on web page that look like this:

-----------------------------------------------------------
Item order form

<order model fieds>
Your name: [___________]
Tel : [____________]
etc.....
</order model fields>

<item and Itemsinorder model fields>
item1_name_here | count [___]
item2_name_here | count [___]
...
itemN_name_here | count [___]
</item model fields>

(Submit)
-----------------------------------------------------------

In this form i need to create new order with items and their count.
Looks simply. But i can't do it.. :(

Item that displayed in this form is queering from model Item (all
items must be displayed).

How can i do it?

my models:

class Item(ImageModel):
name = models.CharField(max_length=100)

class Order(models.Model):
name = models.CharField(max_length=100)
tel = models.CharField(max_length=100)

class Itemsinorder(models.Model):
itemcount = models.IntegerField()
order = models.ForeignKey(Order)
item = models.ForeignKey(Item)

Thanks.
p.s. sorry for my English.

--
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.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment