2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 21:15:41 +00:00

Better string formatting for models

Allows for easier searching in drop-downs for ForeignKeys
This commit is contained in:
Oliver
2018-05-09 00:17:39 +10:00
parent 233f093093
commit 7644617af0
4 changed files with 21 additions and 13 deletions

View File

@ -145,12 +145,7 @@ class Part(models.Model):
notes = models.TextField(blank=True)
def __str__(self):
if self.IPN:
return "{name} ({ipn})".format(
ipn=self.IPN,
name=self.name)
else:
return self.name
return "{n} - {d}".format(n=self.name, d=self.description)
class Meta:
verbose_name = "Part"