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