fixed to string of ingredient

This commit is contained in:
vabene1111 2024-01-13 21:30:39 +08:00
parent 8302521427
commit 65dd82e292

View File

@ -755,7 +755,7 @@ class Ingredient(ExportModelOperationsMixin('ingredient'), models.Model, Permiss
objects = ScopedManager(space='space')
def __str__(self):
return f'{self.pk}: {self.amount} {self.food.name} {self.unit.name}'
return f'{self.pk}: {self.amount} ' + (self.food.name if self.food else ' ') + (self.unit.name if self.unit else '')
class Meta:
ordering = ['order', 'pk']