BaseModel __unicode__ method now returns str(pk) if the 'name' attribute does not exist

This commit is contained in:
Dana Van Aken 2019-08-27 13:23:18 -04:00
parent 7c964758e9
commit e6a57d4c92
1 changed files with 8 additions and 2 deletions

View File

@ -422,12 +422,18 @@ class PipelineRun(models.Model):
start_time = models.DateTimeField() start_time = models.DateTimeField()
end_time = models.DateTimeField(null=True) end_time = models.DateTimeField(null=True)
def __unicode__(self):
return str(self.pk)
def __str__(self):
return self.__unicode__()
class Meta: # pylint: disable=old-style-class,no-init class Meta: # pylint: disable=old-style-class,no-init
ordering = ["-id"] ordering = ["-id"]
class PipelineData(models.Model): class PipelineData(models.Model):
pipeline_run = models.ForeignKey(PipelineRun) pipeline_run = models.ForeignKey(PipelineRun, verbose_name='group')
task_type = models.IntegerField(choices=PipelineTaskType.choices()) task_type = models.IntegerField(choices=PipelineTaskType.choices())
workload = models.ForeignKey(Workload) workload = models.ForeignKey(Workload)
data = models.TextField() data = models.TextField()