Commit da5e3117 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

removed duplicated 'website' directory-- byproduct over merging

parent 1f9c35a9
from rest_framework import serializers
from website.models import Category, Facility, Schedule, OpenTime
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
class FacilitySerializer(serializers.ModelSerializer):
class Meta:
model = Facility
class ScheduleSerializer(serializers.ModelSerializer):
class Meta:
model = Schedule
class OpenTimeSerializer(serializers.ModelSerializer):
class Meta:
model = OpenTime
This diff is collapsed.
body{padding-top:50px}
#banner{border-bottom:none}
.page-header h1{font-size:4em}
.bs-docs-section{margin-top:8em}
footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}
footer p{clear:left;margin-bottom:0}
.splash{background-color:#1c2533;background:-webkit-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-o-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-ms-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-moz-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:linear-gradient(20deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background-attachment:fixed;padding:6em 0 2em;color:#fff;text-align:center}.splash .alert{margin:4em 0 2em}
.splash h1{font-size:4em}
.splash #social{margin-top:6em}
.section-tout{padding:4em 0 3em;border-top:1px solid rgba(255,255,255,0.1);border-bottom:1px solid rgba(0,0,0,0.1);background-color:#eaf1f1}.section-tout .fa{margin-right:.5em}
.section-tout p{margin-bottom:3em}
.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1;border:1px solid rgba(0,0,0,0.1);border-radius:6px}.section-preview .preview .image{padding:5px}.section-preview .preview .image img{border:1px solid rgba(0,0,0,0.1)}
.section-preview .preview .options{text-align:center;padding:0 2em 2em}.section-preview .preview .options p{margin-bottom:2em}
.section-preview .dropdown-menu{text-align:left}
.section-preview .lead{margin-bottom:2em}
@media (max-width:767px){.section-preview .image img{width:100%}}
.bsa .one .bsa_it_ad{border:none !important;background-color:transparent !important}.bsa .one .bsa_it_ad .bsa_it_t,.bsa .one .bsa_it_ad .bsa_it_d{color:inherit !important}
.bsa .one .bsa_it_p{display:none}
.table > tbody > tr > td {
vertical-align: middle;
}
@media screen and (max-width: 379px) {
.page-header h1 {
font-size: 3.2em;
}
}
/* Sticky footer styles
-------------------------------------------------- */
html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 95%;
height: auto;
/* Negative indent footer by its height */
margin: 0 auto -50px;
/* Pad bottom by footer height */
padding: 0 0 50px;
}
/* Set the fixed height of the footer here */
#footer {
height: 50px;
}
.centered{
text-align: center;
}
from django.conf.urls import patterns, include, url
from website.views import *
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'categories', CategoryViewSet)
router.register(r'facilities', FacilityViewSet)
router.register(r'schedules', ScheduleViewSet)
router.register(r'opentimes', OpenTimeViewSet)
urlpatterns = patterns('website.views',
#url(r'^(?:ajax|api)/schedule/', 'ajax_schedule_data', name='schedule_data'),
url(r'^$', 'facility_grid', name='facility_grid'),
url(r'^api/', include(router.urls)),
#facilities open urls
#url(r'^facilities/$', FacilityListView.as_view(), name='faciliites-list'),
#url(r'^facilities/(?P<category>)/$', FacilityCategoryListView.as_view(), name='facilities-list-by-cat'),
#url(r'^facilities/(?P<slug>)/$', FacilityDetailView.as_view(), name='facilities-detail'),
#url(r'^facilities/(?P<on_campus>)/$', FacilityStatusListView.as_view(), name='facilities-list-by-status'),
#schedules urls
#url(r'^schedule/(?P<pk>)/$', ScheduleDetailView.as_view(), name='schedule-detail'),
#opentime urls
url(r'^open-time/(?P<pk>)/$', OpenTimeDetailView.as_view(), name='open-time-detail'),
)
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.views.decorators.http import condition
from django.views.generic import ListView, DetailView
from website.models import Facility, OpenTime, Category, Schedule
from website.api import export_data
from website.serializers import CategorySerializer, FacilitySerializer, ScheduleSerializer, OpenTimeSerializer
from rest_framework import viewsets
from rest_framework.response import Response
import hashlib
import json
class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Category.objects.all()
serializer_class = CategorySerializer
class FacilityViewSet(viewsets.ModelViewSet):
queryset = Facility.objects.all()
serializer_class = FacilitySerializer
class ScheduleViewSet(viewsets.ModelViewSet):
queryset = Schedule.objects.all()
serializer_class = ScheduleSerializer
class OpenTimeViewSet(viewsets.ModelViewSet):
queryset = Schedule.objects.all()
serializer_class = OpenTimeSerializer
class FacilityListView(ListView):
queryset = Facility.objects.all()
serializer_class = FacilitySerializer
class FacilityCategoryListView(ListView):
model = Facility
def get_queryset(self):
return Facility.objects.filter(category=self.kwargs['category'])
class FacilityStatusListView(ListView):
model = Facility
def get_queryset(self):
return Facility.objects.filter(on_campus=self.kwargs['on_campus'])
class FacilityDetailView(DetailView):
model = Facility
class OpenTimeDetailView(DetailView):
model = OpenTime
def facility_grid(request):
"""Display the facilities in a grid. Main page."""
if 'sort' in request.GET:
if request.GET['sort'] == 'location':
# Display the grid by location (instead of listing alphabetically)
pass # Not implemented yet
return render_to_response('facility_grid.html',
context_instance=RequestContext(request))
def gen_etag(request):
return hashlib.sha1(str(OpenTime.objects.all())).hexdigest()
def gen_last_modified(request):
return BaseModel.objects.all().order_by('-last_modified')[0].last_modified
@condition(etag_func=gen_etag, last_modified_func=gen_last_modified)
def ajax_schedule_data(request):
# Wrapping up in an object to avoid possible CSRF attack on top-level
# arrays in JSON objects
return HttpResponse(json.dumps({'data': export_data()}, indent=4),
content_type="application/json")
......@@ -9,6 +9,20 @@ router.register(r'schedules', ScheduleViewSet)
router.register(r'opentimes', OpenTimeViewSet)
urlpatterns = patterns('website.views',
#url(r'^(?:ajax|api)/schedule/', 'ajax_schedule_data', name='schedule_data'),
url(r'^api/', include(router.urls)),
url(r'^$', 'facility_grid', name='facility_grid'),
#facilities open urls
#url(r'^facilities/$', FacilityListView.as_view(), name='faciliites-list'),
#url(r'^facilities/(?P<category>)/$', FacilityCategoryListView.as_view(), name='facilities-list-by-cat'),
#url(r'^facilities/(?P<slug>)/$', FacilityDetailView.as_view(), name='facilities-detail'),
#url(r'^facilities/(?P<on_campus>)/$', FacilityStatusListView.as_view(), name='facilities-list-by-status'),
#schedules urls
#url(r'^schedule/(?P<pk>)/$', ScheduleDetailView.as_view(), name='schedule-detail'),
#opentime urls
url(r'^open-time/(?P<pk>)/$', OpenTimeDetailView.as_view(), name='open-time-detail'),
)
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