Commit 04dea28c authored by Daniel Bond's avatar Daniel Bond

Page displaying stuff now: basics written

parent 24366ebd
File mode changed from 100644 to 100755
from django.db import models
import datetime
class Restaurant(models.Model):
name = models.CharField(max_length = 100)
mainSchedule = models.ForeignKey('Schedule', related_name = 'restaurant_main')
specialSchedules = models.ManyToManyField('Schedule', related_name = 'restaurant_special', null = True, blank = True)
#function
#def analyzer(dayOpen, dayClose):
# if dayOpen is null or dayClose is null:
# return False
# elif timeNow >= dayOpen and timeNow <= dayClose:
# return True
# else:
# return False
def isOpen():
timeNow = datetime.datetime.now().time()
day = datetime.date.today().weekday()
if day is 1:
if monOpen is null or monClose is null:
return False
elif timeNow >= monOpen and timeNow <= monClose:
return True
else:
return False
elif day is 2:
if tueOpen is null or tueClose is null:
return False
elif timeNow >= tueOpen and timeNow <= tueClose:
return True
else:
return False
elif day is 3:
if wedOpen is null or wedClose is null:
return False
elif timeNow >= wedOpen and timeNow <= wedClose:
return True
else:
return False
elif day is 4:
if thuOpen is null or thuClose is null:
return False
elif timeNow >= thuOpen and timeNow <= thuClose:
return True
else:
return False
elif day is 5:
if friOpen is null or friClose is null:
return False
elif timeNow >= friOpen and timeNow <= friClose:
return True
else:
return False
elif day is 6:
if satOpen is null or satClose is null:
return False
elif timeNow >= satOpen and timeNow <= satClose:
return True
else:
return False
elif day is 7:
if sunOpen is null or sunClose is null:
return False
elif timeNow >= sunOpen and timeNow <= sunClose:
return True
else:
return False
#def isC`losing:
class Schedule(models.Model):
name = models.CharField(max_length = 100)
dateValidStart = models.DateField(null = True, blank = True)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.open{
color:green;
font-weight:bold;
font-size:200%;
text-align:center;
}
.closing{
color:yellow;
font-weight:bold;
font-size:200%;
text-align:center;
}
.closed{
color:black;
font-size:200%;
text-align:center;
}
This diff is collapsed.
This diff is collapsed.
......@@ -6,4 +6,5 @@ from django.conf import settings
def alpha (request):
restaurants = Restaurant.objects.all()
#pass to django template
return render_to_response('alpha.html', {'restaurants':restaurants})
restRows = [restaurants[x:x+4] for x in xrange(0, len(restaurants), 4)]
return render_to_response('alpha.html', {'restaurants':restRows})
{% extends 'base.html' %}
{% block content %}
<ul>
{% for restaurant in restaurants %}
<li>
{{ restaurant.name }}
</li>
{% for list in restaurants %}
<div class = "row">
{% for restaurant in list %}
<div class = "span3 {% if restaurant.isOpen %}open{% else %}closed{% endif %}">
{{restaurant.name}}
</div>
{% endfor %}
</div>
{% empty %}
I love to suck cock :-O c===3
(There aren't any restaurants)
There aren't any restaurants
Solution: suck some cocks :-O c===3
{% endfor %}
</ul>
{% endblock %}
<html>
<head>
<title>
What's Open
</title>
</head>
<body>
{% block content%}
{% endblock %}
</body>
{% block head %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/admin/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/admin/css/bootstrap-responsive.min.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script src="/static/admin/js/bootstrap.min.js"></script>
<link href="/static/admin/img/glyphicons-halflings.png" rel="icons">
<head>
{% block title %}
<title>
What's Open
</title>
{% endblock %}
</head>
{% endblock %}
<body>
<div class = 'container'>
{% block content%}
{% endblock %}
</div>
</body>
</html>
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