Added __str__ method to show up useful names in selectors
This commit is contained in:
parent
0554f6427c
commit
344f79b091
|
@ -21,6 +21,9 @@ class ContainerType(models.Model):
|
||||||
changed_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
|
changed_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
|
||||||
related_name='changed_container_types')
|
related_name='changed_container_types')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.named_id + ': ' + self.description
|
||||||
|
|
||||||
|
|
||||||
class Container(models.Model):
|
class Container(models.Model):
|
||||||
named_id = models.CharField(max_length=40)
|
named_id = models.CharField(max_length=40)
|
||||||
|
@ -33,3 +36,6 @@ class Container(models.Model):
|
||||||
changed_ts = models.DateTimeField('datetime updated', auto_now=True)
|
changed_ts = models.DateTimeField('datetime updated', auto_now=True)
|
||||||
changed_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
|
changed_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
|
||||||
related_name='changed_container')
|
related_name='changed_container')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.named_id + ' (' + self.container_type.named_id + '): ' + self.description
|
||||||
|
|
Loading…
Reference in New Issue