Deleting sandwiches works.
[~kgodey/maayanwich.git] / templates / onesandwich.html
index a8096db..d88cfbd 100644 (file)
@@ -1,17 +1,52 @@
-<html>
-       <head>
-               <title>Every Ma'ayanwich Ever!</title></head>
-       <body>
-               <h3>{{ s.adjective }}</h3>
-               <p>Made on {{ s.date_made }} and added by {{ s.user.username }}.</p>
-               <img src="{{ s.picture.url }}">
-               <h5>Ingredients</h5>
-               <ul>
-                       {% for i in s.ingredients.all %}
-                               <li>{{ i.name }}
-                       {% endfor %}
-               </ul>
-               <h5>Notes</h5>
-               <p> {{ s.notes }}</p>
-       </body>
-</html>
\ No newline at end of file
+{% extends "base.html" %}
+
+{% block title %} The {{ s.adjective }} Ma'ayanwich {% endblock %}
+
+{% block content %}
+       <h3 class="sandwichtitle">{{ s.adjective }}</h3>
+       <p class="metadata">Made on {{ s.date_made|date:"F j Y" }} and added by  
+               {% ifequal s.user request.user %} you. 
+                       <a href="{% url edit_sandwich slug=s.slug %}"> (Edit) 
+               {% else %} 
+                       {% if s.user.first_name %} {{ s.user.first_name }} 
+                               {% if s.user.last_name %} {{ s.user.last_name }} 
+                               {% endif %} 
+                       {% else %} 
+                               {{ s.user.username }}. 
+                       {% endif %}
+               {% endifequal %}</p>
+       {% if s.picture %}
+               <img class="sandwichimg" src="{{ s.picture.url }}">
+       {% endif %}
+       <h4 class="sandwichsub">Ingredients</h4>
+       <ul class="ingredients">
+               {% for i in s.ingredients.all %}
+                       <li>{{ i.name }}
+               {% endfor %}
+       </ul>
+       {% if s.notes %}
+               <h4 class="sandwichsub">Notes</h4>
+               <p class="sandnotes"> {{ s.notes }}</p>
+       {% endif %}
+       {% load comments %}
+       {% get_comment_count for s as c %}
+       {% ifequal c 1 %}
+                       <h4 class="sandwichsub">1 Comment</h4>
+       {% else %}
+               {% ifequal c 0 %}
+                       <p class="sandnotes"><b>No comments</b></p>
+               {% else %}
+                       <h4 class="sandwichsub">{{c}} Comments</h4>
+               {% endifequal %}
+       {% endifequal %}
+
+       {% get_comment_list for s as clist %}
+       {% for comment in clist %}
+               <p class="comment_user">{{ comment.user_name }} said:</p>
+               <p class="sandnotes">{{ comment.comment }}</p>
+               <p class="metadata">{{ comment.submit_date }}</p>
+       {% endfor %}
+       <a name="comments"></a> 
+       <h4 class="addcomment">Add a Comment</h4>
+       {% render_comment_form for s %}
+{% endblock %}
\ No newline at end of file