Edit sandwich method added - not completely working yet. Adds a new sandwich instead...
[~kgodey/maayanwich.git] / templates / onesandwich.html
1 {% extends "base.html" %}
2
3 {% block title %} The {{ s.adjective }} Ma'ayanwich {% endblock %}
4
5 {% block content %}
6         <h3 class="sandwichtitle">{{ s.adjective }}</h3>
7         <p class="metadata">Made on {{ s.date_made|date:"F j Y" }} and added by  
8                 {% ifequal s.user request.user %} you. 
9                         <a href="{% url edit_sandwich slug=s.slug %}"> (Edit) 
10                 {% else %} 
11                         {% if s.user.first_name %} {{ s.user.first_name }} 
12                                 {% if s.user.last_name %} {{ s.user.last_name }} 
13                                 {% endif %} 
14                         {% else %} 
15                                 {{ s.user.username }}. 
16                         {% endif %}
17                 {% endifequal %}</p>
18         {% if s.picture %}
19                 <img class="sandwichimg" src="{{ s.picture.url }}">
20         {% endif %}
21         <h4 class="sandwichsub">Ingredients</h4>
22         <ul class="ingredients">
23                 {% for i in s.ingredients.all %}
24                         <li>{{ i.name }}
25                 {% endfor %}
26         </ul>
27         {% if s.notes %}
28                 <h4 class="sandwichsub">Notes</h4>
29                 <p class="sandnotes"> {{ s.notes }}</p>
30         {% endif %}
31         {% load comments %}
32         {% get_comment_count for s as c %}
33         {% ifequal c 1 %}
34                         <h4 class="sandwichsub">1 Comment</h4>
35         {% else %}
36                 {% ifequal c 0 %}
37                         <p class="sandnotes"><b>No comments</b></p>
38                 {% else %}
39                         <h4 class="sandwichsub">{{c}} Comments</h4>
40                 {% endifequal %}
41         {% endifequal %}
42
43         {% get_comment_list for s as clist %}
44         {% for comment in clist %}
45                 <p class="comment_user">{{ comment.user_name }} said:</p>
46                 <p class="sandnotes">{{ comment.comment }}</p>
47                 <p class="metadata">{{ comment.submit_date }}</p>
48         {% endfor %}
49         <a name="comments"></a> 
50         <h4 class="addcomment">Add a Comment</h4>
51         {% render_comment_form for s %}
52 {% endblock %}