51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""collection URL Configuration
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
https://docs.djangoproject.com/en/1.11/topics/http/urls/
|
|
Examples:
|
|
Function views
|
|
1. Add an import: from my_app import views
|
|
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
|
|
Class-based views
|
|
1. Add an import: from other_app.views import Home
|
|
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
|
|
Including another URLconf
|
|
1. Import the include() function: from django.conf.urls import url, include
|
|
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
|
"""
|
|
from django.conf.urls import url, include
|
|
from django.contrib import admin
|
|
from collection import __version__ as app_version
|
|
from games.views import (
|
|
GameList,
|
|
GameViewSet,
|
|
GameTimelineViewSet,
|
|
PlatformViewSet,
|
|
)
|
|
from rest_framework import routers
|
|
from rest_framework.documentation import include_docs_urls
|
|
|
|
# Admin config
|
|
admin.site.site_title = 'OpenBackloggery'
|
|
admin.site.site_header = '%s %s' % (admin.site.site_title, app_version)
|
|
|
|
# Django Rest Framework router
|
|
router = routers.DefaultRouter()
|
|
router.register(r'games', GameViewSet)
|
|
router.register(r'platforms', PlatformViewSet)
|
|
router.register(
|
|
r'game_timelines',
|
|
GameTimelineViewSet,
|
|
base_name='game_timeline')
|
|
|
|
urlpatterns = [
|
|
url(r'^$', GameList.as_view(), name='homepage'),
|
|
url(r'^games/', include('games.urls', namespace='games'), name='games'),
|
|
url(r'^admin/', admin.site.urls),
|
|
url(r'^api/v1/', include(router.urls), name='api'),
|
|
url(r'^api/v1/docs/', include_docs_urls(title=' '.join(
|
|
[admin.site.site_title,
|
|
'API']))),
|
|
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
|
|
]
|