Hello all,
I try to use django-mptt, i changed my country model in order to be a
tree

class Country(models.Model):
    country_name = models.CharField(max_length=30)
    parent    = models.ForeignKey('self', null=True, blank=True,
related_name='children')

    def __unicode__(self):
        return u'%s' % self.country_name

class Customer(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=30)
    website = models.URLField(blank=True)
    country = models.ForeignKey(Country, blank=True)

    def __unicode__(self):
        return self.name
    def get_absolute_url(self):
        return "/customer/%s/" % self.name
    class Meta:
        ordering = ['name']

class Field(models.Model):
    field_name = models.CharField(max_length=100)
    customer = models.ForeignKey(Customer)
    country = models.ForeignKey(Country, blank=True)

    def __unicode__(self):
        return self.field_name
    def get_absolute_url(self):
        return "/field/%s/" % self.field_name
    class Meta:
        ordering = ['field_name']
mptt.register(Country, order_insertion_by=['country_name'])

i synchronize the database
CREATE INDEX "coltrane_country_parent_id" ON
"coltrane_country" ("parent_id");
CREATE INDEX "coltrane_country_lft" ON "coltrane_country" ("lft");
CREATE INDEX "coltrane_country_rght" ON "coltrane_country" ("rght");
CREATE INDEX "coltrane_country_tree_id" ON
"coltrane_country" ("tree_id");
CREATE INDEX "coltrane_country_level" ON "coltrane_country" ("level");
CREATE INDEX "coltrane_customer_country_id" ON
"coltrane_customer" ("country_id");
CREATE INDEX "coltrane_field_customer_id" ON
"coltrane_field" ("customer_id");
CREATE INDEX "coltrane_field_country_id" ON
"coltrane_field" ("country_id");

i have the coltrane_country_parent_id" column in the coltrane_country
table
but when i try to access the country page in the admin page , i obtain
this traceback
Caught an exception while rendering: no such column:
coltrane_country.parent_id
Request Method:         GET
Request URL:    http://127.0.0.1:8000/admin/coltrane/country/
Exception Type:         TemplateSyntaxError
Exception Value:        Caught an exception while rendering: no such column:
coltrane_country.parent_id
Exception Location:     /Library/Python/2.6/site-packages/django/template/
debug.py in render_node, line 81

It s true i don' have the coltrane_country.parent_id, but on the other
hand i have coltrane_country_parent_id.

Can any body help me.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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