Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hunter T Jozwiak
whats-open
Commits
a8c80d79
Verified
Commit
a8c80d79
authored
May 27, 2017
by
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
whats_open/website/urls.py
View file @
a8c80d79
...
...
@@ -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
...
...
whats_open/website/views.py
View file @
a8c80d79
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment