Wednesday, July 30, 2014

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


I have following model definition and when I try to create a migration
using command, 'python 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

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

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(

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(


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
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment