Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
roomlist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
roomlist
Commits
5a7158af
Commit
5a7158af
authored
Oct 23, 2016
by
Daniel W Bond
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'amherst' of git.gmu.edu:srct/roomlist into amherst
parents
914b51fc
20ad550e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
roomlist/api/urls.py
roomlist/api/urls.py
+15
-7
No files found.
roomlist/api/urls.py
View file @
5a7158af
...
...
@@ -3,6 +3,7 @@ from __future__ import absolute_import, print_function
# core django imports
from
django.conf.urls
import
patterns
,
include
,
url
from
django.views.generic
import
RedirectView
from
django.views.decorators.cache
import
cache_page
# imports from your apps
from
.views
import
BuildingList
,
BuildingRetrieve
,
FloorRetrieve
,
RoomRetrieve
,
\
MajorList
,
MajorRetrieve
,
APIRoot
...
...
@@ -12,24 +13,31 @@ from .views import BuildingList, BuildingRetrieve, FloorRetrieve, RoomRetrieve,\
# API v1
# separate out major and building patterns
building_urls
=
patterns
(
''
,
url
(
r'^$'
,
BuildingList
.
as_view
(),
name
=
'api_list_buildings'
),
url
(
r'^(?P<building_name>[\w-]+)/$'
,
BuildingRetrieve
.
as_view
(),
name
=
'api_detail_building'
),
url
(
r'^$'
,
cache_page
(
60
*
60
)(
BuildingList
.
as_view
()),
name
=
'api_list_buildings'
),
url
(
r'^(?P<building_name>[\w-]+)/$'
,
cache_page
(
60
*
60
)(
BuildingRetrieve
.
as_view
()),
name
=
'api_detail_building'
),
# the naming here and for floors is a little obnoxious
url
(
r'^(?P<building__building_name>[\w-]+)/(?P<floor_num>\d+)/$'
,
FloorRetrieve
.
as_view
(),
name
=
'api_detail_floor'
),
url
(
r'^(?P<building__building_name>[\w-]+)/(?P<floor_num>\d+)/$'
,
cache_page
(
60
*
60
)(
FloorRetrieve
.
as_view
()),
name
=
'api_detail_floor'
),
# list all the floors still?
url
(
r'^(?P<floor__building__building_name>[\w-]+)/(?P<floor__floor_num>\d+)/(?P<room_num>\d+)/$'
,
RoomRetrieve
.
as_view
(),
name
=
'api_detail_room'
),
url
(
r'^(?P<floor__building__building_name>[\w-]+)/(?P<floor__floor_num>\d+)/(?P<room_num>\d+)/$'
,
cache_page
(
60
*
60
)(
RoomRetrieve
.
as_view
()),
name
=
'api_detail_room'
),
# list all the rooms still?
)
major_urls
=
patterns
(
''
,
url
(
r'^$'
,
MajorList
.
as_view
(),
name
=
'api_list_majors'
),
url
(
r'^(?P<slug>[\w-]+)/$'
,
MajorRetrieve
.
as_view
(),
name
=
'api_detail_major'
),
url
(
r'^$'
,
cache_page
(
60
*
60
)(
MajorList
.
as_view
()),
name
=
'api_list_majors'
),
url
(
r'^(?P<slug>[\w-]+)/$'
,
cache_page
(
60
*
60
)(
MajorRetrieve
.
as_view
()),
name
=
'api_detail_major'
),
)
# Added API Caching
urlpatterns
=
patterns
(
''
,
url
(
r'^v1/housing/'
,
include
(
building_urls
)),
url
(
r'^v1/majors/'
,
include
(
major_urls
)),
url
(
r'^v1/$'
,
APIRoot
.
as_view
(),
name
=
'api_root'
),
url
(
r'^v1/$'
,
cache_page
(
60
*
60
)(
APIRoot
.
as_view
()),
name
=
'api_root'
),
url
(
r'^$'
,
RedirectView
.
as_view
(
pattern_name
=
'api_root'
)),
)
...
...
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