Unable to create migration with Error - One or more models did not validate:

33 views
Skip to first unread message

Subodh Nijsure

unread,
Jul 30, 2014, 7:34:52 AM7/30/14
to django...@googlegroups.com
Hello,

I have following model definition and when I try to create a migration
using command, 'python manage.py schemamigration asset_mgmt
--initial' I am getting following error:

CommandError: One or more models did not validate:
asset_mgmt.alarmtable: 'polling_config' has a relation with model
AssetPollingConfig, which has either not been installed or is
abstract.

I have other classes that extend the TimeStampedModel and I don't see
this error, can someone point me towards reason I am getting this
error?


class TimeStampedModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abstract = True

class AssetPollingInfo(TimeStampedModel):
id = models.AutoField(primary_key=True)
alarm_text = models.CharField(max_length=800,blank=True,null=True)
asset_id = models.ForeignKey('AssetInfo')
thresholds = models.ForeignKey('ThresholdInfo')
dispatch = models.ForeignKey('AlarmDispatchInfo')
class Meta:
ordering = ['-id']
def __unicode__(self):
return str(self.id)

class AlarmTable(TimeStampedModel):
id = models.AutoField(primary_key=True)
polling_config = models.ForeignKey('AssetPollingConfig')
alarm_text = models.CharField(max_length=800,blank=False,null=False)
event_type = models.SmallIntegerField(blank=False,null=False)
trigger_point = models.IntegerField(blank=True,null=True)
class Meta:
ordering = ['-id']
def __unicode__(self):
return str(self.id)


-Subodh

ma...@tubeards.com

unread,
Jul 30, 2014, 7:54:29 AM7/30/14
to django...@googlegroups.com
Hi,

you've added a relation to the AssetPollingConfig model which is not defined.

Cheers

Subodh Nijsure

unread,
Jul 30, 2014, 8:05:54 AM7/30/14
to django...@googlegroups.com
duh! Thank you so much... Sometimes when you are on short-sleep you
make silly mistakes!!

-Subodh
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5a541fa1-208f-40ce-92f7-89546872d8d5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages