Redirects to error pages for most pages work. Still todo: adding/editing sandwiches...
[~kgodey/maayanwich.git] / templates / allsandwiches.html
index 24f15b7..4f3a901 100644 (file)
@@ -1,10 +1,19 @@
 {% extends "base.html" %}
 
 {% block content %}
 {% extends "base.html" %}
 
 {% block content %}
-       <h1 class="pagetitle">All Ma'ayanwiches</h1>
                {% for s in allsandwiches %}
                        <h3 class="sandwichtitle">{{ s.adjective }}</h3>
                {% for s in allsandwiches %}
                        <h3 class="sandwichtitle">{{ s.adjective }}</h3>
-                       <p class="metadata">Made on {{ s.date_made }} and added by {{ s.user.username }}.</p>
+                       <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 %}
                        {% if s.picture %}
                                <img class="sandwichimg" src="{{ s.picture.url }}">
                        {% endif %}
                                        <li>{{ i.name }}
                                {% endfor %}
                        </ul>
                                        <li>{{ i.name }}
                                {% endfor %}
                        </ul>
-                       <h4 class="sandwichsub">Notes</h5>
-                       <p class="sandnotes"> {{ s.notes }}</p>
+                       {% 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 %}
+                               <p class="sandnotes"><a href="{{ s.get_absolute_url }}">1 comment</a></p>
+                       {% else %}
+                               <p class="sandnotes"><a href="{{ s.get_absolute_url }}">{{ c }} comments</a></p>
+                       {% endifequal %}
                {% endfor %}
 {% endblock %}
\ No newline at end of file
                {% endfor %}
 {% endblock %}
\ No newline at end of file