KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following classes: Ingredients, Recipe and RecipeContent... class Ingredient(models.Model): name = models.CharField(max_length=30, primary_key=True) qty_on_stock = models.IntegerField() def __unicode__(self): return self.name class Recipe(models.Model): name = models.CharField(max_length=30, primary_key=True) comments = models.TextField(blank=True) ingredient = models.ManyToManyField(Ingredient) def __unicode__(self): return self.name class RecipeContent(models.Model): recipe = models.ForeignKey(Recipe) ingredients = models.ForeignKey(Ingredient) qty_used = models.IntegerField() but for __unicode__() in RecipeContent I would like to use the Recipe name to which this RecipeContent belongs to... is there a way to do it?
Tags (comma-separated)
Save Edits
Cancel