diff --git a/recette/models.py b/recette/models.py index b6fee15..a18e0d6 100644 --- a/recette/models.py +++ b/recette/models.py @@ -49,3 +49,6 @@ class Composition(models.Model): ingredient = models.ForeignKey(Ingredient, on_delete=models.PROTECT) quantite = models.DecimalField(max_digits=6, decimal_places=3, null=True, blank=True) unite = models.ForeignKey(Unite, null=True, blank=True, on_delete=models.PROTECT) + + def __str__(self): + return "%s %s %s" % (self.quantite, self.unite.nom, self.ingredient.nom) diff --git a/templates/recette.html b/templates/recette.html index 062d145..f634389 100644 --- a/templates/recette.html +++ b/templates/recette.html @@ -3,19 +3,21 @@ {% block content %}

{{ recette.nom }}

-{% if recette.photo %} -
-{% endif %} -
{{ recette.prep|linebreaksbr }}
{% if recette.ingredients.count %} +

Ingrédients

+
+{% endif %} + +{% if recette.photo %} +
{% endif %} {% endblock %}