擅长:python、mysql、java
<pre><code>class Ingredient(models.Model):
cost_by = .....
def __str__(self):
if self.cost_by == 1:
self.cost_by = 'Units'
elif self.cost_by == 2:
self.cost_by = 'Kilograms'
elif self.cost_by == 3:
self.cost_by = 'Litters'
return self.cost
</code></pre>