openbackloggery/collection/collection/urls.py

60 lines
2.1 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 import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from figurines.views import FigurineViewSet
from figurines.views import SetViewSet
from games.views import GameList
from games.views import GameTimelineViewSet
from games.views import GameViewSet
from games.views import PlatformViewSet
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from collection import __version__ as app_version
# 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'figurines', FigurineViewSet)
router.register(r'platforms', PlatformViewSet)
router.register(r'sets', SetViewSet)
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'))
]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns