When running the following command via the Django shell:
from myApp.models import *
print Categorytree.objects.all()
I receive this error message:
OperationalError: (1054, "Unknown column 'categorytree.id' in 'field list'")
This is what my Model looks like:
class Categorytree(models.Model):
level = models.IntegerField(db_column='Level') # Field name made lowercase.
categorynode_idcategorynode = models.ForeignKey(Categorynode, models.DO_NOTHING, db_column='CategoryNode_idCategoryNode') # Field name made lowercase.
categorynode_idancestorcategorynode = models.ForeignKey(Categorynode, models.DO_NOTHING, db_column='CategoryNode_idAncestorCategoryNode', related_name='+') # Field name made lowercase.
class Meta:
managed = False
db_table = 'categorytree'
unique_together = (('categorynode_idcategorynode', 'categorynode_idancestorcategorynode'),)
Note that it does not have a Primary Key and it shouldn't have, but Django seems to think there would be an Primary Key .id Field.