Commit 89cc213c authored by Benjamin S Waters's avatar Benjamin S Waters
Browse files

api completegoing to work through bugs

parent 38f07a2b
......@@ -10,10 +10,14 @@ urlpatterns = patterns('',
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^api/v1/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'', include('whats_open_site.urls')),
url(r'', include(website.urls)),
url(r'^login/$', 'django.contrib.auth.views.login', {
'template_name': 'login.html'})
url(r'^logout/$', 'django.contrib.auth.views.logout', {
'next_page': '/'})
)
from django.conf.urls import patterns, url
from .views import FacilityListView, FacilityCategoryListView, FacilityStatusListView, FacilityDetailView, ScheduleDetailView, OpenTimeDetailView
from .views import *
from rest_framework.routers import DefaultRouter
#router = DefaultRouter()
router = DefaultRouter()
router.register(r'categories', CategoryViewSet)
router.register(r'facilities', FacilityViewSet)
router.regsiter(r'schedules', ScheduleViewSet)
router.register(r'opentimes', OpenTimeViewSet)
urlpatterns = patterns('whats_open_site.views',
url(r'^(?:ajax|api)/schedule/', 'ajax_schedule_data', name='schedule_data'),
url(r'^$', 'facility_grid', name='facility_grid'),
#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'),
......
......@@ -15,6 +15,22 @@ 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):
model = Facility
queryset = Facility.objects.all()
......
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