views.py 530 Bytes
Newer Older
Daniel Bond's avatar
Daniel Bond committed
1 2 3 4 5
from website.models import Restaurant, Schedule
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

6 7

def alpha_grid(request):
Daniel Bond's avatar
Daniel Bond committed
8
    restaurants = Restaurant.objects.all()
9 10 11 12
    # 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})