I have an existing mysql db. I reverse engineered the models.py with
inspectdb...

My foreign key names seem to be messing up the query that django
generates:

OperationalError at /admin/ghsite/inventory/
  (1054, "Unknown column 'inventory.keyfgallid_id' in 'field list'")

Here is my invemtory model:

class Inventory(models.Model):
    keypid = models.IntegerField(primary_key=True)
    keyfgallid = models.ForeignKey(Gallery)
    sku = models.CharField(maxlength=45)
    name = models.CharField(maxlength=360)
    artist = models.CharField(blank=True, maxlength=450)
    firm = models.CharField(maxlength=765)
    client = models.CharField(maxlength=765)
    description = models.TextField()
    date_info = models.CharField(maxlength=300)
    keyfcategoryid = models.ForeignKey(Category)
    keyfsubcategoryid = models.ForeignKey(Subcategory)
    h = models.CharField(maxlength=120)
    w = models.CharField(maxlength=120)
    d = models.CharField(maxlength=120)
    show_www = models.IntegerField()
    show_image = models.IntegerField()
    image = models.CharField(maxlength=120)
    original_image_name = models.CharField(maxlength=765)
    price = models.FloatField(max_digits=12, decimal_places=31)
    item_type = models.CharField(maxlength=150)
    class Meta:
        db_table = 'inventory'
    class Admin:
        pass


Here is my gallery model:

class Gallery(models.Model):
    keypid = models.IntegerField(primary_key=True)
    date_begin = models.DateTimeField()
    time_stamp_begin = models.DateTimeField()
    active_flag = models.IntegerField()
    gallery_name = models.CharField(maxlength=360)
    html_title = models.CharField(maxlength=765)
    contact_person = models.CharField(maxlength=300)
    contact_email = models.CharField(maxlength=300)
    address = models.CharField(maxlength=450)
    address2 = models.CharField(blank=True, maxlength=450)
    city = models.CharField(maxlength=450)
    state = models.CharField(maxlength=450)
    postal = models.CharField(maxlength=45)
    class Meta:
        db_table = 'gallery'
    class Admin:
        pass


How can I fix this without renaming all of the keys?

Best regards,

David


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to