Beispiel #1
0
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers

from .views import CheckUsername, CheckEmail, UserView, UserDetailView, AddressViewSet

app_name = 'users'
urlpatterns = [
    re_path(r'usernames/(?P<username>\w{5,20})/count/',
            CheckUsername.as_view(),
            name='check_username'),
    re_path(r'emails/(?P<email>\w+@\w+.\w+)/count/',
            CheckEmail.as_view(),
            name='check_email'),
    path('', UserView.as_view(), name='users'),
    path('user/detail/', UserDetailView.as_view(), name='user_detail'),
    path('authorizations/', obtain_jwt_token),
]

routers = routers.DefaultRouter()
routers.register(r'addresses', AddressViewSet, base_name='addresses')
urlpatterns += routers.urls

# POST /users/addresses/ 新建 -> create
# PUT /users/addresses/<pk>/ 修改 -> update
# GET /users/addresses/ 查询 -> list
# DELETE /users/addresses/  删除 -> destroy

# PUT /users/addresses/<pk>/status/ 设置默认地址  -> status
# PUT /users/addresses/<pk>/title/ 设置标题  -> title
Beispiel #2
0
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path , include

from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from posts.views import PostViewSet, CommitsViewSet



routers = routers.DefaultRouter()
routers.trailing_slash = ''
routers.register('posts',PostViewSet)
routers.register('commits',CommitsViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('docs/', include_docs_urls(title='django post')),
    path('admin/', admin.site.urls),

]
Beispiel #3
0
from django.urls import path, include
from . import views
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.urls import re_path
from django.conf.urls.static import static
from rest_framework import routers
from .views import PlanViewSet

routers = routers.DefaultRouter()
routers.register('DetallePlanes', PlanViewSet)

urlpatterns = [
    #path('', views.plan_list, name='plan_list'),
    path('plan/<int:pk>/', views.plan_venta, name='plan_venta'),
    path('plan/<int:pk>/', views.plan_contrato, name='plan_contrato'),
    re_path(r'^$', views.index2,
            name="index2"),  # funcion re_path remplaza url
    re_path(r'^planes/plan_list.html/$', views.plan_list, name="plan_list"),
    re_path(r'^contacto.html/$', views.contacto, name="contacto"),
    re_path(r'^Mapa.html/$', views.Mapa, name="Mapa"),
    re_path(r'^nosotros.html/$', views.nosotros, name="nosotros"),
    re_path(r'^login.html/$', views.login, name="login"),
    re_path(r'^registrar.html/$', views.registrar, name="registrar"),
    path('reset_password/',
         auth_views.PasswordResetView.as_view(
             template_name="planes/templates/password_reset.html"),
         name="reset_password"),
    path('reset_password_sent/',
         auth_views.PasswordResetDoneView.as_view(
             template_name="planes/password_reset_done.html"),
Beispiel #4
0
from django.conf.urls import url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from gestao_rh import settings

from apps.funcionarios.API.views import FuncionarioViewSet
from apps.registro_hora_extra.API.views import HoraExtraViewSet

from rest_framework import routers

routers = routers.DefaultRouter()
routers.register(r'api/funcionarios', FuncionarioViewSet)
routers.register(r'api/banco-horas', HoraExtraViewSet)

urlpatterns = [
    path('', include('apps.core.urls')),
    path('admin/', admin.site.urls),
    path('funcionarios/', include('apps.funcionarios.urls')),
    path('empresas/', include('apps.empresas.urls')),
    path('departamentos/', include('apps.departamentos.urls')),
    path('documentos/', include('apps.documentos.urls')),
    path('horas-extras/', include('apps.registro_hora_extra.urls')),
    path('accounts/', include('django.contrib.auth.urls')),

    # ROTAS DA API
    url(r'^', include(routers.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #5
0
from django.contrib import admin
from django.conf import settings
from django.urls import path, include
from django.conf.urls.static import static
from rest_framework import routers, serializers, viewsets
from repositorio import views

routers = routers.DefaultRouter()
routers.register(r'users', views.UserViewSet)
routers.register(r'trabalho', views.TrabalhoList)

urlpatterns = [
    path('jet/', include('jet.urls', 'jet')),  # jet URLS
    path('admin/', admin.site.urls),
    path('', include(routers.urls)),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework')),
]

if settings.DEBUG:
    urlpatterns += static(
        settings.STATIC_URL, document_root=settings.STATIC_URL) + static(
            settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
@Software: PyCharm
@Author  : cn
@Email   : [email protected]
@File    : urls.py
@Time    : 19-7-6 下午8:28
@version : v1.0
"""

from django.conf.urls import url, include
from rest_framework import routers
from . import views

routers = routers.DefaultRouter()

routers.register(r'books', views.BooksModelviewset)

urlpatterns = [
    url(r"", include(routers.urls)),
    # url(r'^books/$',views.BooksModelviewset.as_view({'get':'list','post':'create'}),name='books_list'),
    url(r'^books/bid=(?P<pk>\d+)/$',
        views.BooksModelviewset.as_view({
            'get': 'retrieve',
            'put': 'update',
            'patch': 'partial_update',
            'delete': 'destroy'
        }),
        name='book_detail'),
    url(r'^authors/$', views.Authorsview.as_view(), name='authors_list'),
    url(r'^authors/aid=(?P<pk>\d+)/$',
        views.AuthorsDetailview.as_view(),
Beispiel #7
0
# -*- coding: utf-8 -*-

from django.conf.urls import include, url
from django.conf.urls import patterns
from django.conf import settings

from django.contrib import admin
from rest_framework import routers
import views_app, views
from rest_framework.authtoken.views import obtain_auth_token
from account.decorators import login_exempt

routers = routers.DefaultRouter()
routers.register(r'app', views_app.ApplicationViewSet)
routers.register(r'package', views_app.PackageViewSet)
routers.register(r'version', views_app.VersionViewSet)

urlpatterns = patterns(
    'appcc.views',
    (r'^$', 'home'),
    (r'^base_main', 'base_main'),
    (r'^home', 'home'),
    #appdelivery
    (r'^app_delivery/$', 'app_list'),
    (r'app_delivery/applist/(?P<app_id>(\d+))/$', 'applists'),
    (r'^main_deploy', 'app_info'),
    (r'^app_deploy', 'app_deploy'),
    (r'^deploy_maintain', 'deploy_maintain'),
    (r'^deploy_historytask', 'deploy_historytask'),
    #tool
    (r'^tool_list', 'tool_list'),
Beispiel #8
0
from django.urls import include, path
from rest_framework import routers
from .views import *

routers = routers.DefaultRouter()
routers.register(r'users', UserViewSet)
routers.register(r'group', GroupViewSet)
urlpatterns = routers.urls
Beispiel #9
0
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url

from .views import home_page, about_page, contact_page, login_page, register_page, logout_page

from .api import PersonViewSet, RegisterAPI, LoginAPI, UserAPI
from rest_framework import routers
from knox import views as knox_views

routers = routers.DefaultRouter()
routers.register('person', PersonViewSet, 'person')

urlpatterns = [
    path('api/', include(routers.urls)),
    path('api/auth', include('knox.urls')),
    path('api/auth/register', RegisterAPI.as_view()),
    path('api/auth/login', LoginAPI.as_view()),
    path('api/auth/user', UserAPI.as_view()),
    path('api/auth/logout',
         knox_views.LogoutView.as_view(),
         name='knox_logout'),
    # url(r'^$', home_page),
    # url(r'^about/$', about_page),
    # url(r'^contact$', contact_page),
    # url(r'^login/', login_page),
    # url(r'^logout/', logout_page),
Beispiel #10
0
from django.urls import path, include
from . import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('ReservaBarberia', views.BarberoList)

urlpatterns = [
    path('', include(routers.urls)),
]
Beispiel #11
0
from django.conf.urls import url
from django.contrib import admin
from blog import views
from rest_framework import routers
from django.conf.urls import url, include

routers = routers.DefaultRouter()
routers.register('userinfo',views.TestModelViewSet)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^register/',views.register,),
    url(r'^login/', views.login, ),
    url(r'^test/', views.test, ),
    url(r'^cbvtest/', views.Test.as_view(), ),
    url(r'^rdftest/', views.TestRDF.as_view(), ),

    # 加括号可以实现url传参,视图函数里request后面的参数对应括号里的参数
    # 括号前面加上名字叫分组命名,名字要和视图函数里的参数名字一样
    url(r'^sertest/(?P<pk>\d+)', views.TestDetailSerializers.as_view(), ),
    url(r'^sertest/', views.TestSerializers.as_view(), ),

    url(r'',include(routers.urls)),
    # url(r'^viewsettest/(?P<pk>\d+)', views.TestModelViewSet.as_view({'get':'retrieve','put':'update','delete':'destroy'}),name='userinfo' ),
    # url(r'^viewsettest/', views.TestModelViewSet.as_view({'get':'list','post':'create'}),name='userinfo'  ),

    url(r'^authtest/', views.AuthTest.as_view()),

]
Beispiel #12
0
from django.urls import path, include
from rest_framework import routers
from . import views as api_views
from rest_framework.authtoken.views import obtain_auth_token
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
"""
Dient dazu die URLs zu definieren bzw. zu der Logik mappen.
Es generiert automatisch die URLs und mappt die einzelnen endpoints zu den einzelnen viewsets, 
basirend auf den http-Typ (get, post, ...)
"""
routers = routers.DefaultRouter()
routers.register(r'providers', api_views.ProviderViewSet)
routers.register(r'places', api_views.PlaceViewSet)
routers.register(r'teachers', api_views.TeacherViewSet)
routers.register(r'students', api_views.StudentViewSet)
routers.register(r'courses', api_views.CourseViewSet)
routers.register(r'users', api_views.UserViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('api-token-auth/', obtain_auth_token),
    path('schema/', SpectacularAPIView.as_view(), name='schema'),
    path('schema/swagger-ui/',
         SpectacularSwaggerView.as_view(url_name='schema'),
         name='swager-ui'),
    path('schema/redoc-ui/',
         SpectacularRedocView.as_view(url_name='schema'),
         name='redoc-ui'),
]
Beispiel #13
0
from rest_framework import routers
from . import views


routers = routers.DefaultRouter()
routers.register('action-types', views.ActionTypeViewSet)
routers.register('activities', views.ActivitiesViewSet)
routers.register('activity-properties', views.ActivityPropertiesViewSet)
routers.register('activity-smids', views.ActivitySmidViewSet)
routers.register('activity-stds-lookups', views.ActivityStdsLookupViewSet)
routers.register('activity-supp-maps', views.ActivitySuppMapViewSet)
routers.register('activity-supps', views.ActivitySuppViewSet)
routers.register('assay-parameters', views.AssayParametersViewSet)
routers.register('assay-types', views.AssayTypeViewSet)
routers.register('assays', views.AssaysViewSet)
routers.register('atc-classifications', views.AtcClassificationViewSet)
routers.register('binding-sites', views.BindingSitesViewSet)
routers.register('bio-component-sequences', views.BioComponentSequencesViewSet)
routers.register('bioassay-ontologies', views.BioassayOntologyViewSet)
routers.register('biotherapeutic-components', views.BiotherapeuticComponentsViewSet)
routers.register('biotherapeutics', views.BiotherapeuticsViewSet)
routers.register('cell-dictionaries', views.CellDictionaryViewSet)
routers.register('chembl-id-lookups', views.ChemblIdLookupViewSet)
routers.register('component-class', views.ComponentClassViewSet)
routers.register('component-domains', views.ComponentDomainsViewSet)
routers.register('component-goes', views.ComponentGoViewSet)
routers.register('component-sequences', views.ComponentSequencesViewSet)
routers.register('component-synonyms', views.ComponentSynonymsViewSet)
routers.register('compound-properties', views.CompoundPropertiesViewSet)
routers.register('compound-records', views.CompoundRecordsViewSet)
Beispiel #14
0
from django.conf.urls import url, include
from rest_framework import routers

from contest import views

routers = routers.DefaultRouter()
routers.register('contest', views.ContestView)
routers.register('contest-announcement', views.ContestAnnouncementView)

urlpatterns = [
    url('', include(routers.urls)),
    url(r'^contest/([0-9]+)/add-problem/$',
        views.ContestAddProblemAPIView.as_view()),
    url(r'^contest/([0-9]+)/remove-problem/$',
        views.ContestDeleteProblemAPIView.as_view()),
    url(r'^contest/([0-9]+)/problems/$',
        views.ContestListProblemAPIView.as_view()),
    url(r'^contest/([0-9]+)/join-with-pwd/$',
        views.JoinContestWithPwd.as_view()),
    url(r'^contest/([0-9]+)/join/$', views.JoinContest.as_view()),
    url(r'^contest-rank/', views.ContestRankView.as_view()),
]
Beispiel #15
0
from django.urls import path, include
from app import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('dev', views.QuestionApi)

app_name = 'app'
urlpatterns = [
    path('', views.DevList.as_view(), name='list'),
    path('(?P<pk>\d+)', views.DevDetail.as_view(), name='detail'),
    path('api/', include(routers.urls), name='api'),
]
Beispiel #16
0
from rest_framework import routers
from .views import EducationViewSet, SkillsViewSet

routers = routers.SimpleRouter()
routers.register('profile/education', EducationViewSet, basename='education')
routers.register('profile/skills', SkillsViewSet, basename='skills')
urlpatterns = []
urlpatterns += routers.urls
Beispiel #17
0
"""api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from todo import views

routers = routers.DefaultRouter()
routers.register(r'tasks', views.TaskView, 'todo')

urlpatterns = [
    path('admin/', admin.site.urls),
    # TODO implement versioning (using v1 for compatibility with existing Postman test cases)
    path('api/v1/', include(routers.urls)),
]
Beispiel #18
0
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from . import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('putitem', views.ItemPutView)

urlpatterns = [
    url('', include(routers.urls)),
    url(r'^item', views.ItemGetAPIView.as_view()),
]
Beispiel #19
0
from django.conf.urls import url, include
from rest_framework import routers
from submission import views

routers = routers.DefaultRouter()
routers.register("submit", views.SubmissionCreateView)
routers.register("submission", views.SubmissionGetView)
routers.register("sharing", views.SubmissionSharing)
routers.register("contest-submission", views.ContestSubmissionGetView),
routers.register("manager-submission", views.ManagerSubmissionView)
urlpatterns = [
    url('', include(routers.urls)),
    url(r'^rejudge/$', views.SubmissionRejudgeAPI.as_view())
]
Beispiel #20
0
from django.conf.urls import url, include
from submission import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('judgestatus', views.JudgeStatusView)
routers.register('getcode', views.GetCodeView)
routers.register('casestatus', views.CaseStatusView)
routers.register('quicktest', views.QuickTestView)
routers.register('rankboard', views.RankBoardView)

urlpatterns = [
    url('', include(routers.urls)),
    url(r'submitcode', views.SubmitCodeView.as_view(), name='submitcode'),
    url(r'submittestcode',
        views.QuickTestSubmitCodeView.as_view(),
        name='submittestcode'),
    url(r'^rejudge', views.RejudgeView.as_view(), name='rejudge'),
]
Beispiel #21
0
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.urls import include
from django.conf.urls import url
from rest_framework import routers
from search.views import VideoSearchView
from content import views as content_views

routers = routers.DefaultRouter()
routers.register("youtube-token",
                 content_views.YoutubeAPIKeyViewSet,
                 base_name='youtube-token')
routers.register("video-details",
                 content_views.VideoViewSet,
                 base_name='video')
routers.register("video-thumbnail",
                 content_views.VideoThumbnailViewSet,
                 base_name='video-thumbnail')
routers.register("video/search", VideoSearchView, base_name="video-search")

urlpatterns = [url(r'^api/', include(routers.urls))]
Beispiel #22
0
    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 app01 import views

#第三种url简写
#简写第一步
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register(r"books001", views.BookViewSet)  #books001为URL前缀

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^publisher/$', views.PublsherMixView.as_view()),
    # url(r'^publisher/(\d+)/$', views.PublisherDetailView.as_view()), #不加超链接
    url(r'^publisher/(?P<pk>\d+)/',
        views.PublisherDetailMix.as_view(),
        name="publisher_detail"),
    url(r'^book/$', views.BookMixView.as_view()),
    url(r'^book/(?P<pk>\d+)/$', views.BookDetailMix.as_view()),

    ##**********第二种*******
    url(r'^publishers/$', views.PublsherGenView.as_view()),
    url(r'^publishers/(?P<pk>\d+)/$', views.PublisherDetailGen.as_view()),
    url(r'^books/$', views.BookGenView.as_view(), name="book_list"),
Beispiel #23
0
from django.urls import path, include
from rest_framework import routers
from . import views as api_views
from rest_framework.authtoken.views import obtain_auth_token
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView

routers = routers.DefaultRouter()
routers.register(r'books', api_views.BookViewSet)
routers.register(r'authors', api_views.AuthorViewSet)
routers.register(r'places', api_views.PlaceViewSet)
routers.register(r'customers', api_views.CustomerViewSet)
routers.register(r'rents', api_views.RentViewSet)
routers.register(r'users', api_views.UserViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('api-token-auth/', obtain_auth_token),
    path('schema/', SpectacularAPIView.as_view(), name='schema'),
    path('schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
    path('schema/redoc-ui/', SpectacularRedocView.as_view(url_name='schema'), name='redoc-ui'),
]
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from core.api.viewsets import PontoTuristicoViewSet
from atracao.api.viewsets import AtracaoViewSet
from localizacao.api.viewsets import LocalizacaoViewSet
from comentario.api.viewsets import ComentarioViewSet
from avaliacao.api.viewsets import AvaliacaoViewSet

routers = routers.DefaultRouter()
routers.register(r'pontosturisticos',
                 PontoTuristicoViewSet,
                 basename='PontoTuristico')
routers.register(r'atracao', AtracaoViewSet)
routers.register(r'localizacoes', LocalizacaoViewSet)
routers.register(r'comentarios', ComentarioViewSet, basename='Comentario')
routers.register(r'avaliacoes', AvaliacaoViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('admin/', admin.site.urls),
]
Beispiel #25
0
from rest_framework import routers
from . import views
from django.urls import path, include
from rest_framework.authtoken.views import obtain_auth_token

routers = routers.DefaultRouter()
routers.register('messages', views.MessageViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('api-token-auth/', obtain_auth_token, name='api_token_auth')
]
Beispiel #26
0
from webapi.viewsets import employeesViewset
from webapi.viewsets import ProductViewset
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('employees', employeesViewset)
routers.register('products', ProductViewset)

Beispiel #27
0
from rest_framework import routers
from blog.api.views import PostModelViewSet, CommentModelViewSet

routers = routers.DefaultRouter()
routers.register('Post', PostModelViewSet)
routers.register('Comment', CommentModelViewSet)
urlpatterns = routers.urls
Beispiel #28
0
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from . import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('userdata', views.UserDataView)
routers.register('user', views.UserView)
routers.register('change', views.UserChangeView)
routers.register('changeall', views.UserChangeAllView)
routers.register('userlogindata', views.UserLoginDataView)

urlpatterns = [
    url('', include(routers.urls)),
    url(r'^register', views.UserRegisterAPIView.as_view()),
    url(r'^login', views.UserLoginAPIView.as_view()),
    url(r'^logout', views.UserLogoutAPIView.as_view()),
    url(r'^updaterating', views.UserUpdateRatingAPIView.as_view()),
]
Beispiel #29
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from quickstart import views

routers = routers.DefaultRouter()
routers.register(r'users', views.UserViewSet)
routers.register(r'groups', views.GroupViewSet)

urlpatterns = [
    path('', include(routers.urls)),
    path('api-auth', include('rest_framework.urls',
                             namespace='rest_framework')),
    path('admin/', admin.site.urls),
    path('', include('snippets.urls'))
]
Beispiel #30
0
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from . import views
from rest_framework import routers

routers = routers.DefaultRouter()
routers.register('contestannouncement', views.ContestAnnouncementView)
routers.register('contestcomment', views.ContestCommentView)
routers.register('contestinfo', views.ContestInfoView)
routers.register('contestcominginfo', views.ContestComingInfoView)
routers.register('contestproblem', views.ContestProblemView)
routers.register('contestboard', views.ContestBoardView)
routers.register('contestregister', views.ContestRegisterView)
routers.register('contestratingchange', views.ContestRatingChangeView)
routers.register('contesttutorial', views.ContestTutorialView)

urlpatterns = [
    url('', include(routers.urls)),
    url(r'^currenttime', views.CurrentTimeView.as_view()),
]
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
import django.contrib.auth.views
from news.api.api_view import NewsViewSet


from rest_framework import routers


routers = routers.DefaultRouter()
routers.register(r'api', NewsViewSet)


urlpatterns = [

    url(r'^admin/', admin.site.urls),
    url(r'', include('news.urls')),
    url(r'^', include(routers.urls)),
    # url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^accounts/login/$', django.contrib.auth.views.login, name='login'),
    url(r'^accounts/logout/$', django.contrib.auth.views.logout, name='logout', kwargs={'next_page': '/'}),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]