Commit 15ac169b authored by Nicholas Anderson's avatar Nicholas Anderson
Browse files

Updated Django and DRF to their most current versions

parent 4cbb7c2e
# This file is here because many Platforms as a Service look for Django==1.8.5
# requirements.txt in the root directory of a project. djangorestframework==3.3.0
-r requirements/production.txt gunicorn==19.3.0
wheel==0.24.0
Django>=1.6,<1.7
South==1.0
argparse
distribute
wsgiref
djangorestframework>=2.3
# Local development dependencies go here
-r test.txt
django-debug-toolbar==1.2.1
Sphinx==1.2.2
# Pro-tip: Try not to put anything here. There should be no dependency in
# production that isn't in development.
-r base.txt
gunicorn>=19.0,<20.0
\ No newline at end of file
# Test dependencies go here.
-r base.txt
coverage
var facilities = JSON.parse(localStorage['facilities']) || []; var facilities = JSON.parse(localStorage['facilities'] || "[]" );
function correct_grid_overflow(){ function correct_grid_overflow(){
// This function ensures that all text inside the grid-boxes display nicely on one line. // This function ensures that all text inside the grid-boxes display nicely on one line.
...@@ -144,7 +144,7 @@ $(function() { ...@@ -144,7 +144,7 @@ $(function() {
construct_grid(facilities); construct_grid(facilities);
$.ajax({ $.ajax({
url: '/api/facilities/.json', url: '/api/facilities/?format=json',
}).done(function (data) { }).done(function (data) {
facilities = data; facilities = data;
localStorage['facilities'] = JSON.stringify(facilities); localStorage['facilities'] = JSON.stringify(facilities);
......
{% load staticfiles %} {% load staticfiles %}<!DOCTYPE html>
<!DOCTYPE html>
<html> <html>
{% block head %} {% block head %}
<head> <head>
......
...@@ -4,22 +4,25 @@ from website.models import Category, Facility, Schedule, OpenTime ...@@ -4,22 +4,25 @@ from website.models import Category, Facility, Schedule, OpenTime
class CategorySerializer(serializers.ModelSerializer): class CategorySerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Category model = Category
fields = '__all__'
class OpenTimeSerializer(serializers.ModelSerializer): class OpenTimeSerializer(serializers.ModelSerializer):
schedule = serializers.RelatedField(many=False, read_only=True)
class Meta: class Meta:
model = OpenTime model = OpenTime
fields = '__all__'
class ScheduleSerializer(serializers.ModelSerializer): class ScheduleSerializer(serializers.ModelSerializer):
open_times = OpenTimeSerializer(many=True, read_only=True) open_times = OpenTimeSerializer(many=True, read_only=True)
class Meta: class Meta:
model = Schedule model = Schedule
fields = '__all__'
class FacilitySerializer(serializers.ModelSerializer): class FacilitySerializer(serializers.HyperlinkedModelSerializer):
category = serializers.RelatedField(many=False, read_only=True) category = CategorySerializer(many=False, read_only=True)
main_schedule = serializers.RelatedField(many=False, read_only=True) main_schedule = ScheduleSerializer(many=False, read_only=True)
special_schedules = serializers.RelatedField(many=True, read_only=True) special_schedules = ScheduleSerializer(many=True, read_only=True)
class Meta: class Meta:
model = Facility model = Facility
fields = '__all__'
...@@ -28,7 +28,7 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -28,7 +28,7 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
def get_queryset(self): def get_queryset(self):
queryset = Facility.objects.all() queryset = Facility.objects.all()
open_now = self.request.QUERY_PARAMS.get('open', None) open_now = self.request.query_params.get('open', None)
if open_now is not None: if open_now is not None:
results = [] results = []
for fac in queryset: for fac in queryset:
......
...@@ -215,7 +215,6 @@ DJANGO_APPS = ( ...@@ -215,7 +215,6 @@ DJANGO_APPS = (
# Apps specific for this project go here. # Apps specific for this project go here.
LOCAL_APPS = ( LOCAL_APPS = (
'south',
'website', 'website',
'rest_framework', 'rest_framework',
) )
......
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