Verified Commit a8c80d79 authored by David Haynes's avatar David Haynes 🙆
Browse files

Adding in location model stuffs

- more or less me testing things, will get modified or removed in the future
parent 4af4b385
......@@ -7,7 +7,7 @@ from django.conf.urls import include, url
from django.views.generic.base import RedirectView
# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet, LocationViewSet
# Other Imports
from rest_framework.routers import DefaultRouter
......@@ -19,6 +19,7 @@ ROUTER = DefaultRouter()
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)
ROUTER.register(r'location', LocationViewSet)
urlpatterns = [
# / - Default route
......
......@@ -3,9 +3,9 @@ from __future__ import (absolute_import, division, print_function,
unicode_literals)
# App Imports
from .models import Facility, OpenTime, Category, Schedule
from .models import Facility, OpenTime, Category, Schedule, Location
from .serializers import (CategorySerializer, FacilitySerializer,
ScheduleSerializer, OpenTimeSerializer)
ScheduleSerializer, OpenTimeSerializer, LocationSerializer)
# Other Imports
from rest_framework import viewsets
......@@ -17,6 +17,12 @@ class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Category.objects.all()
serializer_class = CategorySerializer
class LocationViewSet(viewsets.ReadOnlyModelViewSet):
"""
"""
queryset = Location.objects.all()
serializer_class = LocationSerializer
class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
"""
"""
......@@ -31,9 +37,7 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
if open_now is not None:
results = []
for fac in queryset:
print(fac)
if fac.isOpen():
print(True)
results.append(fac)
return results
else:
......
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