I am trying to create a customer database app and the model is as
follows..

# Create your models here.

class Customer(models.Model):
        name = models.CharField(max_length=40)
        address = models.CharField(max_length=100)
        city = models.CharField(max_length=20)
        state = models.CharField(max_length=20)
        country = models.CharField(max_length=20)
        phone = models.CharField(max_length=15)
        mobile = models.CharField(max_length=15)
        fax = models.CharField(max_length=15)
        email = models.EmailField(max_length=15)
        website = models.URLField()
        remarks = models.CharField(max_length=100)

class Product(models.Model):
        productname = models.CharField(max_length=20)
        invoiceno = models.CharField(max_length=10)
        serialno = models.CharField(max_length=20)
        make = models.CharField(max_length=20)
        model = models.CharField(max_length=20)
        capacity = models.CharField(max_length=20)
        installeddate = models.DateField()
        remark = models.CharField(max_length=25)



I am confused on how to relate this.
One customer can buy multiple products so this has to be a one to many
relation. [Correct me if I am wrong]
should I include "      customer = models.ForeignKey(Customer)" in the
"product" class or  product = models.ManytomanyField(Product) in the
"customer" class?

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

Reply via email to