django - relation error on adding new model class -
i have 2 model-classes inside models.py file :
class certificate(models.model): comments = models.textfield(blank=true, default='') generic_certificate = models.foreignkey(genericcertificate, related_name='certificates_awarded') tag = models.foreignkey('tag', related_name='certificates_awarded', null=true, blank=true) class genericcertificate(commoninfo): certificate_type = (('c', 'system created'), ('u', 'user created')) certificate_icon = models.imagefield(upload_to='certificate/icons', default='defaults/certificate.png') certificate_type = models.charfield(choices=certificate_type, max_length=1, default='c') template = models.filefield(upload_to='certificate/generic_templates')
they working fine in django admin , when adding 1 more model class starts giving error on hitting generic certificates option: included operation : south migration , syncdb exception type: programmingerror exception value:
relation "certificates_genericcertificate" not exist line 1: select count(*) "certificates_genericcertificate"
newly added model class in same models.py
class positioncertificate(models.model): rewardee = models.charfield(max_length=50, default = '0,0') org_logo = models.charfield(max_length=50, default = '0,0') tag_name = models.charfield(max_length=50, default = '0,0')
how remove error ? , why error coming ?
error
relation "certificates_genericcertificate" not exist
means "certificates_genericcertificate" relation not exists in database.
please
python manage.py syncdb
and if using south can use
python manage.py migrate
try hit these commands , if not you, drop tables/database , recreate tables/database using syncdb.
Comments
Post a Comment