I've got an app that has the following models:

class Product(models.Model):
    product_name = models.CharField(maxlength=64, blank=False)

    class Admin:
        pass

    def __str__(self):
        return self.product_name

class TestProduct(models.Model):
    oid = models.PositiveIntegerField()
    product=models.OneToOneField(Product, related_name="test_oid")

    def __str__(self):
        return self.product.product_name

    class Admin:
        list_display = ("product","oid")

class ReleasedProduct(models.Model):
    oid = models.PositiveIntegerField()
    product=models.OneToOneField(Product, related_name="released_oid")

    class Admin:
        list_display = ("product","oid")

    def __str__(self):
        return self.product.product_name



I've been doing all my work with sqlite3, and occasionally testing
against PostgreSQL (my eventual db) to make sure everything's working.

And so far, it has been. However, today I tried writing a file to
provide initial data to the db. In sqlite3, it worked fine. PostgreSQL
is choking over it though.

The simplest version I have that breaks things is product.sql:

insert into oidgenerator_product (product_name) VALUES ("foo");

That's it, that's all there is to it. But the syncdb fails with the following:


Installing initial data for Product model
Failed to install initial SQL data for Product model: ERROR:  column
"foo" does not exist

insert into oidgenerator_product (product_name) VALUES ("foo")



I tried going right into the db with psql, and running the INSERT by
hand, and I get the same error. Does it have something to do with the
way Django sets up one-to-one relationships? It's strange because from
my app level, if I add the Product rows manually through the admin,
everything works fine.

Note: I've never used one-to-one relationships before in any context
(with or without Django), so I could just be missing a fundamental
requirement of doing an INSERT with them.

Thanks,
Jay P.

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