{% extends "base.html" %}
+{% block title %}All Sandwiches{% endblock %}
+
{% block content %}
{% for s in allsandwiches %}
<h3 class="sandwichtitle">{{ s.adjective }}</h3>
{% endfor %}
</ul>
<ul class="newest">
- <li><a href="{% url all_sandwiches %}" class="navlink">All sandwiches</a></li>
+ <li><a href="{% url index_sandwich %}" class="navlink">All sandwiches</a></li>
</ul>
</div>
<div id="content">
{% extends "base.html" %}
+{% block title %}Edit account{% endblock %}
+
{% block content %}
<h1 class="pagetitle">Edit account</h1>
<form enctype="multipart/form-data" action="{% url edit_user gusername=request.user.username %}" method="post" class="cssform">
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}Sandwich Index{% endblock %}
+
+{% block content %}
+ <h1 class="pagetitle">Index of All Sandwiches</h1>
+ {% for s in allsandwiches %}
+ <p class="sandnotes"><a href="{{ s.get_absolute_url }}">{{ s.adjective }}</a></p>
+ {% endfor %}
+{% endblock %}
\ No newline at end of file
-{% block title %}ERROR!{% endblock %}
-
{% extends "base.html" %}
+{% block title %}ERROR!{% endblock %}
+
{% block content %}
<h1 class="pagetitle">You are already logged in!</h1>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
+{% block title %}Login{% endblock %}
+
{% block content %}
<h1 class="pagetitle">Login</h1>
<form enctype="multipart/form-data" action="{% url login %}?{{ request.META.QUERY_STRING }}" method="post" class="cssform">
{% extends "base.html" %}
+{% block title %}Create account{% endblock %}
+
{% block content %}
<h1 class="pagetitle">Create account</h1>
<form enctype="multipart/form-data" action="{% url signup %}" method="post" class="cssform">
-{% block title %}ERROR!{% endblock %}
-
{% extends "base.html" %}
+{% block title %}ERROR!{% endblock %}
+
{% block content %}
<h1 class="pagetitle">You do not have permission to perform this action!</h1>
{% endblock %}
\ No newline at end of file
-{% block title %}ERROR!{% endblock %}
-
{% extends "base.html" %}
+{% block title %}ERROR!{% endblock %}
+
{% block content %}
<h1 class="pagetitle">You are not logged in!</h1>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
+{% block title %}Please login!{% endblock %}
+
{% block content %}
<h3 class="error">You are not logged in.</h3>
<h1 class="pagetitle">Login</h1>
from django.shortcuts import render_to_response
urlpatterns = patterns('',
+ url(r'^sandwich/index/$', views.index_sandwich, name='index_sandwich'),
url(r'^sandwich/add/$', views.add_sandwich, name='add_sandwich'),
url(r'^sandwich/all/$', views.all_sandwich, name='all_sandwiches'),
url(r'^sandwich/(?P<gusername>[-\w]+)/edit/', views.edit_user, name='edit_user'),
except Sandwich.DoesNotExist:
raise Http404
return render_to_response('allsandwiches.html', {'allsandwiches': allsandwiches,}, context_instance=RequestContext(request))
+
+def index_sandwich(request):
+ try:
+ allsandwiches = Sandwich.objects.order_by('adjective')
+ except Sandwich.DoesNotExist:
+ raise Http404
+ return render_to_response('indexsandwiches.html', {'allsandwiches': allsandwiches,}, context_instance=RequestContext(request))
def sandwich_month(request, year, month):