added comment form plus number of comments.
[~kgodey/maayanwich.git] / templates / allsandwiches.html
1 {% extends "base.html" %}
2
3 {% block content %}
4                 {% for s in allsandwiches %}
5                         <h3 class="sandwichtitle">{{ s.adjective }}</h3>
6                         <p class="metadata">Made on {{ s.date_made|date:"F j Y" }} and added by {% if s.user.first_name %} {{ s.user.first_name }} {% if s.user.last_name %} {{ s.user.last_name }} {% endif %} {% else %} {{ s.user.username }}. {% endif %}</p>
7                         {% if s.picture %}
8                                 <img class="sandwichimg" src="{{ s.picture.url }}">
9                         {% endif %}
10                         <h4 class="sandwichsub">Ingredients</h4>
11                         <ul class="ingredients">
12                                 {% for i in s.ingredients.all %}
13                                         <li>{{ i.name }}
14                                 {% endfor %}
15                         </ul>
16                         {% if s.notes %}
17                                 <h4 class="sandwichsub">Notes</h4>
18                                 <p class="sandnotes"> {{ s.notes }}</p>
19                         {% endif %}
20                         {% load comments %}
21                         {% get_comment_count for s as c %}
22                         {% ifequal c 1 %}
23                                 <p class="sandnotes"><a href="{{ s.get_absolute_url }}">1 comment</a></p>
24                         {% else %}
25                                 <p class="sandnotes"><a href="{{ s.get_absolute_url }}">{{ c }} comments</a></p>
26                         {% endifequal %}
27                 {% endfor %}
28 {% endblock %}