Added __str__ method to show up useful names in selectors

This commit is contained in:
Dirk Jahnke 2022-04-12 07:03:48 +02:00
parent 0554f6427c
commit 344f79b091
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,9 @@ class ContainerType(models.Model):
changed_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
related_name='changed_container_types')
def __str__(self):
return self.named_id + ': ' + self.description
class Container(models.Model):
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_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_deleted_user),
related_name='changed_container')
def __str__(self):
return self.named_id + ' (' + self.container_type.named_id + '): ' + self.description