Commit 2445573f authored by Daniel Bond's avatar Daniel Bond
Browse files


parent daff625b
from website.models import Restaurant
import re
def export_data():
restaurants = list()
for restaurant in Restaurant.objects.all():
# Sort the restaurants by alphabetical order ignoring "the" and "a"
alphalist = sorted(Restaurant.objects.all(),
key=lambda r: re.sub('^(the|a) ', '',, count=1,
for restaurant in alphalist:
restaurant_data = {'name':, 'id':}
open_times = list()
for time in restaurant.main_schedule.open_times.all():
......@@ -4,7 +4,6 @@ from website.api import export_data
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.views.decorators.http import condition
import re
import hashlib
import json
......@@ -15,15 +14,7 @@ def restaurant_grid(request):
if request.GET['sort'] == 'location':
# Display the grid by location (instead of listing alphabetically)
pass # Not implemented yet
restaurants = Restaurant.objects.all()
# Sort the restaurants by alphabetical order ignoring "the" and "a"
restaurants = sorted(restaurants,
key=lambda r: re.sub('^(the|a) ', '',, count=1,
# 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('restaurant_grid.html', {'restRows': restRows,
'restaurants': restaurants},
return render_to_response('restaurant_grid.html',
def gen_etag(request):
......@@ -37,7 +37,8 @@
<div class = clock>
at {% now "H:i" %}
<!--All nice and static... this will too will likely be changing soon. -->
<!-- this is in 24 hour time :-/ -->
<div class="row">
<div class="span6 offset5">
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