示例#1
0
from inspect import isclass
from dynamic_rest.routers import DynamicRouter
from bbook_backend.api import views
from rest_framework.authtoken import views as authtoken_views

urlpatterns = []
if 'django.contrib.admin' in settings.INSTALLED_APPS:
    urlpatterns.append(url(r'^admin/', admin.site.urls))

router = DynamicRouter()


def register_views(views):
    for name in dir(views):
        view = getattr(views, name)
        if (isclass(view) and getattr(view, 'serializer_class', None)
                and getattr(view, 'IS_CANONICAL', True)):
            router.register_resource(view, namespace='v0')


register_views(views)

router.register(r'v0/story_recordings', views.StoryRecordingViewSet)

urlpatterns.extend([
    url(r'^', include(router.urls)),
    url(r'^api-token-auth/', authtoken_views.obtain_auth_token),
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^rest-auth/registration/', include('rest_auth.registration.urls'))
])
from django.urls import include, path

from dynamic_rest.routers import DynamicRouter

from .apiviews import (CustomerViewSet, EmployeeViewSet, InventoryViewSet,
                       OrderViewSet, OrderItemViewSet)

router = DynamicRouter()
router.register('customers', CustomerViewSet)
router.register('employees', EmployeeViewSet)
router.register('inventories', InventoryViewSet)
router.register('orders', OrderViewSet)
router.register('order-items', OrderItemViewSet)

urlpatterns = [path('', include(router.urls))]
示例#3
0
from rest_framework_jwt.views import refresh_jwt_token
from dynamic_rest.routers import DynamicRouter
from django.conf.urls import url, include
from api import views

router = DynamicRouter()

router.register(r'site-settings', views.SiteSettingsViewSet)
router.register(r'slack-hooks', views.SlackHookViewSet)
router.register(r'users', views.UserViewSet)
router.register(r'profiles', views.ProfileViewSet)
router.register(r'email-servers', views.EmailServerViewSet)
router.register(r'phishing-domains', views.PhishingDomainViewSet)
router.register(r'scraper-user-agents', views.ScraperUserAgentViewSet)
router.register(r'schedules', views.ScheduleViewSet)
router.register(r'schedule-windows', views.ScheduleWindowViewSet)
router.register(r'landing-pages', views.LandingPageViewSet)
router.register(r'redirect-pages', views.RedirectPageViewSet)
router.register(r'email-templates', views.EmailTemplateViewSet)
router.register(r'clients', views.ClientViewSet)
router.register(r'campaigns', views.CampaignViewSet)
router.register(r'result-events', views.ResultEventViewSet)
router.register(r'target-data', views.TargetDatumViewSet)
router.register(r'targets', views.TargetViewSet)
router.register(r'target-lists', views.TargetListViewSet)
router.register(r'target-lists-flat-view', views.TargetListFlatViewSet)
router.register(r'vector-emails', views.VectorEmailViewSet)
router.register(r'engagements', views.EngagementViewSet)
router.register(r'oauth-engagements', views.OAuthEngagementViewSet)
router.register(r'oauth-consumers', views.OAuthConsumerViewSet)
router.register(r'oauth-results', views.OAuthResultViewSet)
示例#4
0
from django.conf.urls import include, url
from dynamic_rest.views import login, logout
from dynamic_rest.routers import DynamicRouter
from tests import viewsets

router = DynamicRouter()
router.register_resource(viewsets.UserViewSet)
router.register_resource(viewsets.GroupViewSet)
router.register_resource(viewsets.ProfileViewSet)
router.register_resource(viewsets.LocationViewSet)

router.register(r'cars', viewsets.CarViewSet)
router.register(r'cats', viewsets.CatViewSet)
router.register_resource(viewsets.DogViewSet)
router.register_resource(viewsets.HorseViewSet)
router.register_resource(viewsets.PermissionViewSet)
router.register(r'zebras', viewsets.ZebraViewSet)  # not canonical
router.register(r'user_locations', viewsets.UserLocationViewSet)

# the above routes are duplicated to test versioned prefixes
router.register_resource(viewsets.CatViewSet, namespace='v2')  # canonical
router.register(r'v1/user_locations', viewsets.UserLocationViewSet)
router.register(r'p/users', viewsets.PermissionsUserViewSet, namespace='p')
router.register('login', login)
router.register('logout', logout)

urlpatterns = [url(r'^', include(router.urls))]
示例#5
0
from web import views

from rest_framework import routers
from dynamic_rest.routers import DynamicRouter

from django.conf.urls import url, include

router = DynamicRouter()
router.register('users', views.UserViewSet)
router.register('teams', views.TeamViewSet)
router.register('organizations', views.OrganizationViewSet)
router.register('memberships', views.MembershipViewSet)

router.register('reliefmaps', views.ReliefMapViewSet)

router.register(r'mapitemtemplates', views.MapItemTemplateViewSet)
router.register(r'filterpresets', views.FilterPresetViewSet)
router.register(r'templatepresets', views.TemplatePresetViewSet)
router.register(r'datalayers', views.DataLayerViewSet)

router.register(r'mapitems', views.MapItemViewSet)

urlpatterns = [
    url(r'users/me/$',
        views.UserViewSet.as_view({'get': 'retrieve'}),
        kwargs={'pk': 'me'}),
    url(r'^', include(router.urls))
]
示例#6
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django.conf.urls import include, url
from dynamic_rest.routers import DynamicRouter

from .viewset import AAViewSet, AViewSet, BBViewSet, BViewSet

router = DynamicRouter()
router.register('a', AViewSet)
router.register('aa', AAViewSet)
router.register('b', BViewSet)

router.register('bb', BBViewSet)

urlpatterns = [
    url(r'^api/v1/', include(router.urls)),
    url(r'', include('testapi.urls')),
]
示例#7
0
"""
__Seed builder__v0.1.8
  AUTO_GENERATED (Read only)
  Modify via builder
"""

from django.urls import path, include
from django.conf.urls import url
from dynamic_rest.routers import DynamicRouter

from app.views import BusinessViewSet
from app.views import CategoryViewSet
from app.views import StatViewSet
from app.views import UserViewSet
from app.views import UserTypeViewSet
from app.views import FileView

router = DynamicRouter()
router.register(r'businesses', BusinessViewSet)
router.register(r'categories', CategoryViewSet)
router.register(r'stats', StatViewSet)
router.register(r'users', UserViewSet)
router.register(r'user_types', UserTypeViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('files/', FileView.as_view()),
    url(r'^auth/', include('rest_auth.urls'))
]
from django.conf.urls import include, url

from dynamic_rest.routers import DynamicRouter
from dapp1 import views
from django.contrib import admin


router = DynamicRouter()
#router.register_resource(views.UserViewSet)
#router.register_resource(views.GroupViewSet)
#router.register_resource(views.LocationViewSet)

router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'location', views.LocationViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url('admin/', admin.site.urls)
]

urlpatterns += [url(r'^silk/', include('silk.urls', namespace='silk'))]

示例#9
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import django.views.static
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.http.response import HttpResponse, HttpResponseForbidden
from django.views.generic.base import RedirectView
from dynamic_rest.routers import DynamicRouter

from testapi.viewset import (AuthorizedPizzaViewSet, MenuViewSet, PizzaGroupViewSet, PizzaViewSet, ReviewViewSet,
                             ToppingViewSet, fake_oauth, fake_view, wait)

router = DynamicRouter()
router.register('pizza', PizzaViewSet, base_name='pizza')
router.register('review', ReviewViewSet)
router.register('topping', ToppingViewSet)
router.register('menulol', MenuViewSet)
router.register('pizzagroup', PizzaGroupViewSet)

router.register('authpizza', AuthorizedPizzaViewSet)

urlpatterns = [
    url(r'^api/v2/wait', wait),
    url(r'^oauth2/token/$', fake_oauth),
    url(r'^api/v2/view/$', fake_view),
    url(r'^api/v2/', include(router.urls)),
    url(r'^api/forbidden', lambda request: HttpResponseForbidden()),
    url(r'^other/view/', lambda request: HttpResponse(b'{"result": "ok"}')),
    url(r'admin/', admin.site.urls),
示例#10
0
from django.urls import include, path

from dynamic_rest.routers import DynamicRouter

from .apiviews import UserViewSet


router = DynamicRouter()
router.register('users', UserViewSet)

urlpatterns = [
    path('', include(router.urls))
]
示例#11
0
from django.conf.urls import url, include
from dynamic_rest.routers import DynamicRouter

from sw import views

router = DynamicRouter()
router.register('planet', views.PlanetViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
]
示例#12
0
文件: urls.py 项目: ksjny/api
from logit import views

from rest_framework import routers
from dynamic_rest.routers import DynamicRouter

from django.urls import include, path

router = DynamicRouter()

router.register('users', views.UserViewSet)
router.register('diagnosis', views.DiagnosisViewSet)
router.register('medication', views.MedicationViewSet)
router.register('symptom', views.SymptomViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('classify/<int:user_id>', views.classify),
    path('users/me/',
         views.UserViewSet.as_view({'get': 'retrieve'}),
         kwargs={'pk': 'me'}),
]
示例#13
0
    https://docs.djangoproject.com/en/1.10/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 dynamic_rest.routers import DynamicRouter
from restapi import views
router = DynamicRouter()
router.register(r'spacers', views.SpacerViewSet)
router.register(r'repeats', views.RepeatViewSet)
router.register(r'organisms', views.OrganismViewSet)
router.register(r'locuspacerrepeats', views.LSRViewSet)
router.register(r'casproteins', views.CasProteinViewSet)
router.register(r'organismcas', views.OCViewSet)
router.register(r'loci', views.LocusViewSet)
router.register(r'organismselfspacers', views.OSSViewSet)
urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^admin/', admin.site.urls),
]
示例#14
0
from django.conf.urls import include, patterns, url

from dynamic_rest.routers import DynamicRouter
from tests import viewsets

router = DynamicRouter()
router.register_resource(viewsets.UserViewSet)
router.register_resource(viewsets.GroupViewSet)
router.register_resource(viewsets.ProfileViewSet)
router.register_resource(viewsets.LocationViewSet)

router.register(r'cats', viewsets.CatViewSet)
router.register_resource(viewsets.DogViewSet)
router.register_resource(viewsets.HorseViewSet)
router.register(r'zebras', viewsets.ZebraViewSet)  # not canonical
router.register(r'user_locations', viewsets.UserLocationViewSet)

# the above routes are duplicated to test versioned prefixes
router.register_resource(viewsets.CatViewSet, namespace='v2')  # canonical
router.register(r'v1/user_locations', viewsets.UserLocationViewSet)

urlpatterns = patterns(
    '',
    url(r'^', include(router.urls))
)
from django.urls import path, include
from rental import views
from dynamic_rest.routers import DynamicRouter

router = DynamicRouter()
friends = router.register(r'friends', views.FriendViewSet)
router.register(r'belongings', views.BelongingViewSet)
router.register(r'borrowings', views.BorrowedViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('signin/', views.signin),
    path('user-info/', views.user_info),
    path('users/', views.UserCreate.as_view(), name='account-create'),
]
示例#16
0
from django.conf.urls import include, url

from dynamic_rest.routers import DynamicRouter
from tests import viewsets

router = DynamicRouter()
router.register_resource(viewsets.UserViewSet)
router.register_resource(viewsets.GroupViewSet)
router.register_resource(viewsets.ProfileViewSet)
router.register_resource(viewsets.LocationViewSet)

router.register(r'cars', viewsets.CarViewSet)
router.register(r'cats', viewsets.CatViewSet)
router.register_resource(viewsets.DogViewSet)
router.register_resource(viewsets.HorseViewSet)
router.register_resource(viewsets.PermissionViewSet)
router.register(r'zebras', viewsets.ZebraViewSet)  # not canonical
router.register(r'user_locations', viewsets.UserLocationViewSet)
router.register(r'alternate_locations', viewsets.AlternateLocationViewSet)
router.register(r'carsv2', viewsets.CarWritableViewSet)

# the above routes are duplicated to test versioned prefixes
router.register_resource(viewsets.CatViewSet, namespace='v2')  # canonical
router.register(r'v1/user_locations', viewsets.UserLocationViewSet)

urlpatterns = [url(r'^', include(router.urls))]
示例#17
0
from django.urls import include
from django.conf.urls import url

from dynamic_rest.routers import DynamicRouter

from .views import ArticleViewSet, ImageViewSet, KeywordViewSet, SectionViewSet

app_name = 'content'

router = DynamicRouter()

router.register('article', ArticleViewSet)
router.register('image', ImageViewSet)
router.register('keyword', KeywordViewSet)
router.register('section', SectionViewSet)

urlpatterns = [url(r'^', include(router.urls))]
示例#18
0
"""djbackend URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/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 include, path
# from rest_framework import routers
from dynamic_rest.routers import DynamicRouter
from polls import views, serializers
router = DynamicRouter()
router.register(r'question', views.QuestionViewSet)
router.register(r'choice', views.ChoiceViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('admin/', admin.site.urls),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework'))
]
示例#19
0
from django.urls import path, include
from dynamic_rest.routers import DynamicRouter

from plateiq.consumer.views import InvoiceView, DigitalInvoiceView

router = DynamicRouter()
router.register('invoice', InvoiceView)
router.register('digital_invoice',
                DigitalInvoiceView,
                base_name='DigitalInvoiceDetail')

urlpatterns = [
    path('', include(router.urls)),
]
示例#20
0
from dynamic_rest.routers import DynamicRouter
from .views import UserViewSet, WaterCanViewSet, CustomerViewSet
from django.conf.urls import url, include

# The Router
router = DynamicRouter()
router.register('users', UserViewSet)
router.register('water-cans', WaterCanViewSet)
router.register('customers', CustomerViewSet)

urlpatterns = [url(r'^', include(router.urls))]
示例#21
0
from django.conf.urls import include, url
from django.contrib import admin

from rest_framework.routers import DefaultRouter
from dynamic_rest.routers import DynamicRouter
from victorysquare import viewsets

router = DynamicRouter()
router.register(r'organizations', viewsets.OrganizationViewSet)
router.register(r'games', viewsets.GameViewSet)
router.register(r'items', viewsets.ItemViewSet)
router.register(r'difficulties', viewsets.DifficultyViewSet)
router.register(r'categories', viewsets.CategoryViewSet)

urlpatterns = [
    url(r'^', include(router.urls))
]
示例#22
0
from django.conf.urls import include, url

from dynamic_rest.routers import DynamicRouter
from tests import viewsets

router = DynamicRouter()
router.register_resource(viewsets.UserViewSet)
router.register_resource(viewsets.GroupViewSet)
router.register_resource(viewsets.ProfileViewSet)
router.register_resource(viewsets.LocationViewSet)

router.register(r'cats', viewsets.CatViewSet)
router.register_resource(viewsets.DogViewSet)
router.register_resource(viewsets.HorseViewSet)
router.register_resource(viewsets.PermissionViewSet)
router.register(r'zebras', viewsets.ZebraViewSet)  # not canonical
router.register(r'user_locations', viewsets.UserLocationViewSet)

# the above routes are duplicated to test versioned prefixes
router.register_resource(viewsets.CatViewSet, namespace='v2')  # canonical
router.register(r'v1/user_locations', viewsets.UserLocationViewSet)

urlpatterns = [
    url(r'^', include(router.urls))
]
示例#23
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django.conf.urls import include, url
from django.contrib import admin
from django.http.response import HttpResponse, HttpResponseForbidden
from django.views.generic.base import RedirectView
from dynamic_rest.routers import DynamicRouter

from testapi.viewset import (AuthorizedPizzaViewSet, MenuViewSet,
                             Pizza_toppingsViewSet, PizzaGroupViewSet,
                             PizzaViewSet, ToppingViewSet, fake_oauth,
                             fake_view, wait)

router = DynamicRouter()
router.register('pizza', PizzaViewSet)
router.register('topping', ToppingViewSet)
router.register('menulol', MenuViewSet)
router.register('pizzagroup', PizzaGroupViewSet)
router.register('Pizza_topping', Pizza_toppingsViewSet)

router.register('authpizza', AuthorizedPizzaViewSet)

urlpatterns = [
    url(r'^api/v2/wait', wait),
    url(r'^oauth2/token/$', fake_oauth),
    url(r'^api/v2/view/$', fake_view),
    url(r'^api/v2/', include(router.urls)),
    url(r'^api/forbidden', lambda request: HttpResponseForbidden()),
    url(r'^other/view/', lambda request: HttpResponse(b'{"result": "ok"}')),
    url(r'admin/', include(admin.site.urls)),
示例#24
0
from django.http import HttpResponse
from django.urls import path
from dynamic_rest.routers import DynamicRouter

from core.views import ItemViewSet

router = DynamicRouter()
router.register(r'items', ItemViewSet, base_name='items')
urlpatterns = router.urls

urlpatterns += [
    path('favicon.ico', lambda request: HttpResponse('empty')),
]