Sunday, June 27, 2010

Re: trouble with many to many form

Nobody can help me with this :( ?

23 июня 2010 г. 17:43 пользователь Василий Паньшин <netremo@gmail.com> написал:
It's not casual form....

2010/6/23 Casey S. Greene <csgreene@princeton.edu>

I am also pretty new to django but I think that what you are looking for is the many to many through relationship:

http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

Maybe someone else can provide more information if that doesn't get you started.

-- Casey



On 06/23/2010 07:48 AM, netremo wrote:
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.



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