Commit f6476911 authored by Ben Waters's avatar Ben Waters
Browse files

Added serializers and changed a bit of models for use of api and fitting the wiki

parent 09d202f9
...@@ -132,6 +132,7 @@ INSTALLED_APPS = ( ...@@ -132,6 +132,7 @@ INSTALLED_APPS = (
# Uncomment the next line to enable admin documentation: # Uncomment the next line to enable admin documentation:
'django.contrib.admindocs', 'django.contrib.admindocs',
'south', 'south',
'rest_framework',
'website', 'website',
) )
......
{% block about %}
<div class="row about-content">
<div class="col-md-10 col-md-offset-1">
<a id="about-close"><img src="{{ STATIC_URL }}img/close.png"></a>
<h3>What is this?</h3>
<p><b>What's Open</b> is a dynamic web application that lets you easily find out which on-campus locations are currently available. It's a simple alternative to searching for campus hours and filtering though them to figure out which ones are open.</p>
<h3>How does it work?</h3>
<p>The schedules and locations are based on data taken from <a href="http://www.gmu.edu/resources/welcome/hours.html">Mason's hours of operation page</a>. What's Open then uses this data to determine which locations are open and closed and displays them in a simple format.</p>
</div>
</div>
<div class="row" id="about-example">
<div class="col-md-10 col-md-offset-1" id="about-column">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-1 grid-box">
<div class="restaurant opened">Open</div>
</div>
<div class="col-sm-6 col-md-4 col-md-offset-2 grid-box">
<div class="restaurant closed">Closed</div>
</div>
</div>
</div>
</div>
<div class="row about-content">
<div class="col-md-10 col-md-offset-1">
<p class="about-top-p">Clicking on one of the location boxes will display useful information such as its closing time, location, and the weekly schedule. If you stay on the What's Open page for an extended period of time, the view will automatically update to accurately reflect the locations open at the current time.</p>
<h3>Who made this?</h3>
<p>What's Open is a project created by <a href="http://srct.gmu.edu/">GMU SRCT</a> (Student-Run Computing and Technology), a student-run organization at George Mason University that establishes and maintains systems which provide specific services the Mason community. You can find information on the current developers of the project on the <a href="http://srct.gmu.edu/projects/whatsopen">SRCT website</a>. The <a href="http://git.gmu.edu/srct/whats-open">repository of the source code is hosted online as well</a>.</p>
<h3>What's Next?</h3>
<p>As of right now we only offer information pertaining to dining locations of Mason's campus. In the near future we plan to expand our database in order to display information pertaining to other facilities on GMU's campus including student union buildings, libraries, campus retailers, and more.</p>
<p>Keep in mind that What's Open is currently in beta so if there are any browser compatibilities issues, schedule inaccuracies, or if you have a suggestion you can contact one of the <a href="mailto:rharper2@gmu.edu?Subject=What's Open">developers</a> and we can try to respond to the issue.</p>
</div>
</div>
{% endblock %}
<!DOCTYPE html>
<html>
{% block head %}
<head>
{% include 'head.html' %}
</head>
{% endblock %}
<body>
<div class="holder">
{% block nav %}
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">what's open</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<div class="navbar-form navbar-right" role="search">
<div class="form-group">
<input id="searchBar" type="text" class="form-control" placeholder="Search">
</div>
</div>
<ul class="nav navbar-nav navbar-right">
<li>
<a id="about-link">
<span id="about-link-text">About</span><img id="about-close-nav" src="{{ STATIC_URL }}img/close.png">
</a>
</li>
<li class="dropdown" style="display:none;">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Select Campus <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Fairfax</a></li>
<li><a href="#">Arlington</a></li>
<li><a href="#">Prince William</a></li>
</ul>
</li>
</ul>
</div>
</nav>
{% endblock %}
<div id="about-body">
<div class="container" id="about-container">
{% include 'about.html' %}
</div>
</div>
<div id="info-body">
<div class="container" id="info-container">
<div class="row" id="info-row">
<a id="info-close"><img src="{{ STATIC_URL }}img/close.png"></a>
<div class="col-md-12" id="info-name"></div>
<div class="col-md-3" id="info-status"></div>
<div class="col-md-3" id="info-next"></div>
<div class="col-md-3" id="info-location"></div>
<div id="info-schedule"></div>
</div>
</div>
</div>
<div class="container main-container">
<div class="row">
<div class="col-md-12">
{% block content %}
{% endblock %}
</div>
</div>
</div>
{% block footer %}
<div id="footer">
<div class="footer-row">
<a class="gmu-brand" href="http://www.gmu.edu"><img src="{{ STATIC_URL }}img/gmurgb.png" class="gmu-logo"></a>
<div class="col-md-8 col-md-offset-2">
<p class="footer-text">A project of <a href="http://srct.gmu.edu">GMU SRCT</a>. <a href="http://opensource.org/licenses/MIT/">Some rights reserved</a>.<span id="footer-line">&nbsp;&nbsp;|&nbsp;&nbsp;</span><br class="visible-xs visible-sm"/> George Mason University <a href="http://dining.gmu.edu/">Dining Services</a>&nbsp;&nbsp;&nbsp; &nbsp;</p>
</div>
</div>
</div>
{% endblock %}
</div>
</body>
</html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description=" content="What's Open is a dynamic web application that lets you easily find out which on-campus locations are currently available. It's a simple alternative to searching for Mason's campus hours and filtering though them to figure out which ones are open.">
<link rel="icon" href="/favicon.ico">
<link href="{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet">
<link href="{{ STATIC_URL }}css/style.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
<script src="{{ STATIC_URL }}js/grid.js"></script>
<script src="{{ STATIC_URL }}js/typeAhead.js"></script>
<script src="{{ STATIC_URL }}js/info.js"></script>
<script src="{{ STATIC_URL }}js/about.js"></script>
{% block title %}
<title>
What's Open - George Mason University
</title>
{% endblock %}
{% extends 'base.html' %}
{% block campus %}
Fairfax
{% endblock %}
{% block content %}
<div id="grid">
</div>
{% endblock %}
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Restaurant.location'
db.add_column(u'website_restaurant', 'location',
self.gf('django.db.models.fields.CharField')(max_length=100, null=True, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Restaurant.location'
db.delete_column(u'website_restaurant', 'location')
models = {
u'website.basemodel': {
'Meta': {'object_name': 'BaseModel'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'website.opentime': {
'Meta': {'object_name': 'OpenTime', '_ormbases': [u'website.BaseModel']},
u'basemodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['website.BaseModel']", 'unique': 'True', 'primary_key': 'True'}),
'end_day': ('django.db.models.fields.IntegerField', [], {}),
'end_time': ('django.db.models.fields.TimeField', [], {}),
'schedule': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'open_times'", 'to': u"orm['website.Schedule']"}),
'start_day': ('django.db.models.fields.IntegerField', [], {}),
'start_time': ('django.db.models.fields.TimeField', [], {})
},
u'website.restaurant': {
'Meta': {'object_name': 'Restaurant', '_ormbases': [u'website.BaseModel']},
u'basemodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['website.BaseModel']", 'unique': 'True', 'primary_key': 'True'}),
'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'main_schedule': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'restaurant_main'", 'to': u"orm['website.Schedule']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'special_schedules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'restaurant_special'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['website.Schedule']"})
},
u'website.schedule': {
'Meta': {'object_name': 'Schedule', '_ormbases': [u'website.BaseModel']},
u'basemodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['website.BaseModel']", 'unique': 'True', 'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'valid_end': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'valid_start': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'})
}
}
complete_apps = ['website']
\ No newline at end of file
from django.db import models from django.db import models
from django.contrib.auth.models import User
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from autoslug import AutoSlugField
import datetime import datetime
class Category(TimeStampedModel): class Category(TimeStampedModel):
...@@ -8,7 +10,10 @@ class Category(TimeStampedModel): ...@@ -8,7 +10,10 @@ class Category(TimeStampedModel):
class Facility(TimeStampedModel): class Facility(TimeStampedModel):
"""Represents a dining location on campus.""" """Represents a dining location on campus."""
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
owner = models.ForeignKey(User)
slug = AutoSlugField(populate_from='name',unique=True)
category = models.ForeignKey('Category', related_name="facilities", null=True, blank=True) category = models.ForeignKey('Category', related_name="facilities", null=True, blank=True)
location_type = models.CharField(max_length=100,null=True,blank=True)
location = models.CharField(max_length=100, null=True, blank=True) location = models.CharField(max_length=100, null=True, blank=True)
main_schedule = models.ForeignKey('Schedule', main_schedule = models.ForeignKey('Schedule',
related_name='facility_main') related_name='facility_main')
......
from rest_framework import serializers
from website.models import Category, Facility, Schedule, OpenTime
class CategorySerializer(serializers.Serializer):
pass
class FacilitySerializer(serializers.Serializer):
pass
class ScheduleSerializer(serializers.Serializer):
pass
class OpenTimeSerializer(serializers.Serializer):
pass
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