Commit 0e2d7e82 authored by Tyler Hallada's avatar Tyler Hallada
Browse files

Renaming alpha view to alpha_grid. It's more descriptive.

parent e08c4cb0
from django.conf.urls import patterns, include, url
urlpatterns = patterns('website.views',
url(r'^$', 'alpha', name = 'alpha'),
url(r'^$', 'alpha_grid', name = 'alpha_grid'),
)
......@@ -3,8 +3,10 @@ from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.conf import settings
def alpha (request):
def alpha_grid(request):
restaurants = Restaurant.objects.all()
#pass to django template
restRows = [restaurants[x:x+4] for x in xrange(0, len(restaurants), 4)]
return render_to_response('alpha.html', {'restaurants':restRows})
# Restaurants in lists of 4 to easily create rows in template
restRows = [restaurants[x:x + 4] for x in xrange(0, len(restaurants), 4)]
return render_to_response('alpha.html', {'restRows': restRows,
'restaurants': restaurants})
......@@ -2,7 +2,7 @@
{% block content %}
<!-- {% now "jS F Y H:i" %} -->
{% for list in restaurants %}
{% for list in restRows %}
<div class = "row">
{% for restaurant in list %}
<div class = "span3 {% if restaurant.isOpen %}open{% else %}closed{% endif %}">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment