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
SRCT
roomlist
Commits
4816ea10
Commit
4816ea10
authored
Oct 21, 2016
by
Eyad Hasan
Browse files
Added public API caching, fixes issue83
parent
5b84efff
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/api/urls.py
View file @
4816ea10
...
...
@@ -26,11 +26,19 @@ major_urls = patterns('',
url
(
r
'^(?P<slug>[\w-]+)/$'
,
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
'^$'
,
RedirectView
.
as_view
(
pattern_name
=
'api_root'
)),
url
(
r
'^api/$'
,
cache_page
(
60
*
60
)(
APIRoot
)),
url
(
r
'^v1/majors/$'
,
cache_page
(
60
*
60
)(
MajorList
.
as_view
()),
name
=
'api_list_majors'
),
url
(
r
'^v1/housing/$'
,
cache_page
(
60
*
60
)(
BuildingList
.
as_view
()),
name
=
'api_list_buildings'
),
url
(
r
'^(?P<building__building_name>[\w-]+)/(?P<floor_num>\d+)/$'
,
cache_page
(
60
*
60
)(
FloorRetrieve
.
as_view
()),
name
=
'api_detail_floor'
),
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'
),
url
(
r
'^(?P<building_name>[\w-]+)/$'
,
cache_page
(
60
*
60
)(
BuildingRetrieve
.
as_view
()),
name
=
'api_detail_building'
),
url
(
r
'^(?P<slug>[\w-]+)/$'
,
cache_page
(
60
*
60
)(
MajorRetrieve
.
as_view
()),
name
=
'api_detail_major'
),
)
# Subsequent API versions below
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