Below is my models.py
My problem is when I syncdb (I have dropped the db couple times to start over)
the country_name field with m2m never shows in the db. what am I doing wrong? I am using postgres
class Products(models.Model):
hs_number = models.CharField(primary_key=True, blank=True, max_length=4)
product_descript = models.CharField(max_length=250)
class Meta:
db_table = "Products"
def __unicode__(self):
return self.hs_number
class Countries(models.Model):
country_id = models.CharField(primary_key=True, max_length=2, blank=True)
country_name = models.ManyToManyField(Products, through="Imports", blank=True)
region = models.CharField(max_length=200)
class Imports(models.Model):
hs_number = models.ForeignKey(Products)
country_id = models.ForeignKey(Countries)
imported_value2008 = models.DecimalField(max_digits=12, decimal_places=2, default=0.00)
imported_value2009 = models.DecimalField(max_digits=12, decimal_places=2, default=0.00)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a196bda-12d8-4bfa-94d9-db4c6aefa491%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment