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:
@ -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"
|
||||
|
Reference in New Issue
Block a user