python - Being able to have multiple items in Django -


i'm making system keeps track of orders customer orders looking @ products, purchase date, price, etc.

if want able allow user to, say, purchase more 1 product...(i.e. 5, 20, 323523). how can allow user add more products?

here's code have:

class purchaseorder(models.model):     product = models.charfield(max_length=256)     vendor = models.charfield(max_length=256)     dollar_amount = models.floatfield()     purchase_date = models.datefield()     notes = models.textfield( null=true, blank= true) 

i want where

when i'm @ add page:

http://i.imgur.com/u1pu1gp.png

i can add more 1. foreign key relationship? how go implementing that?

yeah, tutorial says 'also note “add another” link next “poll.” every object foreignkey relationship gets free.'.

and personally, add foreign key user. solution here says by:

from django.contrib.auth.models import user ... user = models.foreignkey(user) 

that way, know products belong users.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -