Edit sandwich method added - not completely working yet. Adds a new sandwich instead...
[~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  
7                                 {% ifequal s.user request.user %} you. 
8                                         <a href="{% url edit_sandwich slug=s.slug %}"> (Edit) 
9                                 {% else %} 
10                                         {% if s.user.first_name %} {{ s.user.first_name }} 
11                                                 {% if s.user.last_name %} {{ s.user.last_name }} 
12                                                 {% endif %} 
13                                         {% else %} 
14                                                 {{ s.user.username }}. 
15                                         {% endif %}
16                                 {% endifequal %}</p>
17                         {% if s.picture %}
18                                 <img class="sandwichimg" src="{{ s.picture.url }}">
19                         {% endif %}
20                         <h4 class="sandwichsub">Ingredients</h4>
21                         <ul class="ingredients">
22                                 {% for i in s.ingredients.all %}
23                                         <li>{{ i.name }}
24                                 {% endfor %}
25                         </ul>
26                         {% if s.notes %}
27                                 <h4 class="sandwichsub">Notes</h4>
28                                 <p class="sandnotes"> {{ s.notes }}</p>
29                         {% endif %}
30                         {% load comments %}
31                         {% get_comment_count for s as c %}
32                         {% ifequal c 1 %}
33                                 <p class="sandnotes"><a href="{{ s.get_absolute_url }}">1 comment</a></p>
34                         {% else %}
35                                 <p class="sandnotes"><a href="{{ s.get_absolute_url }}">{{ c }} comments</a></p>
36                         {% endifequal %}
37                 {% endfor %}
38 {% endblock %}