Exemple #1
0
from mkt.api.resources import (CarrierViewSet, CategoryViewSet, error_reporter,
                               ErrorViewSet, PriceTierViewSet,
                               PriceCurrencyViewSet, RefreshManifestViewSet,
                               RegionViewSet, site_config)
from mkt.collections.views import CollectionImageViewSet, CollectionViewSet
from mkt.comm.urls import api_patterns as comm_api_patterns
from mkt.developers.urls import dev_api_patterns, payments_api_patterns
from mkt.features.views import AppFeaturesList
from mkt.receipts.urls import receipt_api_patterns
from mkt.reviewers.urls import api_patterns as reviewer_api_patterns
from mkt.search.api import FeaturedSearchView, SearchView, SuggestionsView
from mkt.stats.urls import stats_api_patterns, txn_api_patterns
from mkt.submit.api import PreviewViewSet, StatusViewSet, ValidationViewSet
from mkt.webapps.api import AppViewSet, PrivacyPolicyViewSet

rocketfuel = SimpleRouter()
rocketfuel.register(r'collections', CollectionViewSet, base_name='collections')

subcollections = SubRouterWithFormat()
subcollections.register('image',
                        CollectionImageViewSet,
                        base_name='collection-image')

apps = SimpleRouter()
apps.register(r'preview', PreviewViewSet, base_name='app-preview')
apps.register(r'validation', ValidationViewSet, base_name='app-validation')
apps.register(r'category', CategoryViewSet, base_name='app-category')
apps.register(r'status', StatusViewSet, base_name='app-status')
apps.register(r'app', AppViewSet, base_name='app')

subapps = SubRouter()
Exemple #2
0
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
from rest_framework.routers import SimpleRouter

import ballot.views
import views

admin.autodiscover()

urlpatterns = patterns('',
                       url(r'^$', views.homepage_view),
                       url(r'^admin/', include(admin.site.urls)),
                       url(r'^static/(?P<path>.*)$',
                           'django.views.static.serve', {
                               'document_root': settings.STATIC_ROOT,
                               'show_indexes': True,
                           }),
                       url(r'^search/', views.search_view),
                       url(r'^locations/(?P<fips_id>[0-9]+)$',
                           views.location_view),
                       url(r'^docs/', include('rest_framework_swagger.urls'))
                       )

# Register all API Viewsets:
api = SimpleRouter()
api.register(r'contributions', views.Contribution)
api.register(r'elections', ballot.views.Election)
urlpatterns += api.urls
from rest_framework.routers import SimpleRouter

from . import views

router = SimpleRouter()
router.register(
    'targets/(?P<target_pk>\d+)/sources',
    views.NestedForeignKeySourceModelViewSet,
    'nested-sources',
)
router.register(
    'targets/(?P<target_model_pk>\d+)/generic-sources',
    views.NestedGenericForeignKeySourceModelViewSet,
    'nested-generic-sources',
)
router.register(
    'm2m-targets/(?P<target_pk>\d+)/m2m-sources',
    views.NestedManyToManySourceModelViewSet,
    'nested-m2m-sources',
)
router.register(
    'm2m-sources/(?P<source_pk>\d+)/m2m-targets',
    views.NestedManyToManyTargetModelViewSet,
    'nested-m2m-targets',
)

urlpatterns = router.urls
# -*- coding: utf-8 -*-
"""
api urls
"""
from django.urls import path, include

from rest_framework.routers import SimpleRouter

from api.views import VehiclesApiListView

app_name = "vehicle_inventory"

vehicles_router = SimpleRouter()

# contact services
vehicles_router.register(r'vehicles',
                         VehiclesApiListView,
                         base_name='api_vehicles')

urlpatterns = [
    path('portal/', include(vehicles_router.urls)),
]
from django.urls import path, include
from rest_framework.routers import SimpleRouter
from users.api.views import *
from rest_framework_nested import routers

# pip install drf-nested-routers

parent_router = SimpleRouter()

parent_router.register('users', UserViewSet, basename='user')

# profile_router = routers.NestedSimpleRouter(
#     router,
#     r'users',
#     lookup='user'
# )
#
# profile_router.register(
#     r'profile',
#     ProfileViewSet,
#     basename='user-profile',
# )

app_name = 'users'

parent_router.register(r'rosettes', RosetteViewSet, basename='rosette')

urlpatterns = [
    path('', include(parent_router.urls)),
    path('photo/', ProfilePhotoUpdateView.as_view()),
    # path('', include(profile_router.urls)),
Exemple #6
0
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from crowdsourcing import views
from crowdsourcing.viewsets.project import *
from crowdsourcing.viewsets.user import UserViewSet, UserProfileViewSet, UserPreferencesViewSet
from crowdsourcing.viewsets.requester import RequesterRankingViewSet, RequesterViewSet

from rest_framework.routers import SimpleRouter
router = SimpleRouter(trailing_slash=True)
router.register(r'api/profile', UserProfileViewSet)
router.register(r'api/user', UserViewSet)
router.register(r'api/preferences', UserPreferencesViewSet)
router.register(r'api/requesterranking', RequesterRankingViewSet)
router.register(r'api/requester', RequesterViewSet)
router.register(r'api/project', ProjectViewSet)
router.register(r'api/category', CategoryViewSet)
router.register(r'api/module', ModuleViewSet)
router.register(r'api/projectrequester', ProjectRequesterViewSet)

urlpatterns = patterns(
    '',
    url(r'^api/v1/auth/forgot-password/$', views.ForgotPassword.as_view()),
    url(r'^api/v1/auth/reset-password/(?P<reset_key>\w+)/(?P<enable>[0-1]*)/$',
        views.reset_password),
    url(r'^api/v1/auth/registration-successful',
        views.registration_successful),
    url(r'^api/v1/auth/logout/$', views.Logout.as_view()),
    url(r'^/account-activation/(?P<activation_key>\w+)/$',
        views.activate_account),
    url(r'^api/oauth2/',
        include('oauth2_provider.urls', namespace='oauth2_provider')),
Exemple #7
0
from rest_framework.routers import SimpleRouter
from Newapp.views import Userview
simple = SimpleRouter()

simple.register('Signup', Userview)
urlpatterns = simple.urls
Exemple #8
0
from rest_framework.routers import SimpleRouter

from src.users.views import UserViewSet

users_router = SimpleRouter()

users_router.register(r'users', UserViewSet)
Exemple #9
0
from django.urls import path
from rest_framework.routers import SimpleRouter

from apps.accounts import views as accounts_views

app_name = "accounts"

routers = SimpleRouter()

routers.register("users", accounts_views.UserViewSet, basename="users")
routers.register("user-types", accounts_views.UserTypeListViewSet, basename="users_types")
routers.register("states", accounts_views.StateListViewSet, basename="state")
routers.register("districts", accounts_views.DistrictListViewSet, basename="district")
routers.register("cities", accounts_views.CityListViewSet, basename="cities")
routers.register("local-body", accounts_views.LocalBodyListViewSet, basename="local_body")

urlpatterns = [
    path("login/", accounts_views.LoginView.as_view(), name="login"),
    path("logout/", accounts_views.LogoutView.as_view(), name="logout"),
    path("forgot-password/", accounts_views.ForgotPasswordLinkView.as_view(), name="forgot_password",),
    path(
        "password-reset-confirm/<str:uidb64>/<str:token>/",
        accounts_views.PasswordResetView.as_view(),
        name="password_reset",
    ),
]

urlpatterns += routers.urls
Exemple #10
0
from django.conf.urls import include, patterns, url

from rest_framework.routers import SimpleRouter

from mkt.api.base import SubRouterWithFormat
from mkt.api.v1.urls import urlpatterns as v1_urls
from mkt.api.views import endpoint_removed
from mkt.collections.views import CollectionImageViewSet, CollectionViewSet
from mkt.feed.views import FeedAppViewSet, FeedItemViewSet

feed = SimpleRouter()
feed.register(r'apps', FeedAppViewSet, base_name='feedapps')
feed.register(r'collections', CollectionViewSet, base_name='collections')
feed.register(r'items', FeedItemViewSet, base_name='feeditems')

subcollections = SubRouterWithFormat()
subcollections.register('image',
                        CollectionImageViewSet,
                        base_name='collection-image')

urlpatterns = patterns(
    '',
    url(r'^rocketfuel/collections/.*', endpoint_removed),
    url(r'^feed/', include(feed.urls)),
    url(r'^feed/collections/', include(subcollections.urls)),
) + v1_urls
Exemple #11
0
# from django.contrib import admin
from django.urls import path, re_path
from LoginUser.views import *
from rest_framework.routers import SimpleRouter
router = SimpleRouter()  #先实例化一个对象  将视图进行一个注册
router.register(r"API/Goods", GoodsViews)  #加S和不加区别不一样的 Goods View 在这里是错误的

urlpatterns = [
    path("goods_list/", goods_list),
    path("add_goods/", add_goods),
    # re_path("goods_list/(?P<page>\d+)/",goods_list),
    re_path("goods_list/(?P<page>\d+)/(?P<status>\d+)/", goods_list),
    re_path("goods_status/(?P<id>\d+)/(?P<status>\w+)/", goods_status),
    re_path("goods_list_api/(?P<page>\d+)/(?P<status>\d+)/", goods_list_api),
    path("goods_list_ajax/", goods_list_ajax),
    path("rase_vue/", rase_vue),
]
#     # path('admin/', admin.site.urls),
#     path("register/",register),
#     path("login/",login),
#     re_path("^$",index),
#     path("index/",index),
# ]
Exemple #12
0
"""URL to view mapping for the projects app."""

from django.conf import settings
from rest_framework.routers import SimpleRouter

from timed.projects import views

r = SimpleRouter(trailing_slash=settings.APPEND_SLASH)

r.register(r"projects", views.ProjectViewSet, "project")
r.register(r"customers", views.CustomerViewSet, "customer")
r.register(r"tasks", views.TaskViewSet, "task")
r.register(r"billing-types", views.BillingTypeViewSet, "billing-type")
r.register(r"cost-centers", views.CostCenterViewSet, "cost-center")

urlpatterns = r.urls
Exemple #13
0
                           error_reporter, ErrorViewSet, PriceTierViewSet,
                           PriceCurrencyViewSet, RefreshManifestViewSet,
                           RegionViewSet, site_config)
from mkt.comm.urls import api_patterns as comm_api_patterns
from mkt.developers.urls import dev_api_patterns, payments_api_patterns
from mkt.features.views import AppFeaturesList
from mkt.receipts.urls import receipt_api_patterns
from mkt.reviewers.urls import api_patterns as reviewer_api_patterns
from mkt.search.views import (FeaturedSearchView, RocketbarView, SearchView,
                            SuggestionsView)
from mkt.stats.urls import stats_api_patterns, txn_api_patterns
from mkt.submit.views import PreviewViewSet, StatusViewSet, ValidationViewSet
from mkt.webapps.views import AppTagViewSet, AppViewSet, PrivacyPolicyViewSet


apps = SimpleRouter()
apps.register(r'preview', PreviewViewSet, base_name='app-preview')
apps.register(r'validation', ValidationViewSet, base_name='app-validation')
apps.register(r'category', CategoryViewSet, base_name='app-category')
apps.register(r'status', StatusViewSet, base_name='app-status')
apps.register(r'app', AppViewSet, base_name='app')

subapps = SubRouter()
subapps.register('refresh-manifest', RefreshManifestViewSet,
                 base_name='app-refresh-manifest')
subapps.register('privacy', PrivacyPolicyViewSet,
                 base_name='app-privacy-policy')
subapps.register('tags/(?P<tag_text>\w+)', AppTagViewSet, base_name='app-tags')

services = SimpleRouter()
Exemple #14
0
#
__author__ = 'bob'
__date__ = '2019/8/27 14:46'

from rest_framework.routers import SimpleRouter
from myarticle.views import ArticleViewSet

article_router = SimpleRouter()
article_router.register(r'auth', ArticleViewSet)
Exemple #15
0
from rest_framework_nested import routers
from rest_framework.routers import DefaultRouter, SimpleRouter

from django.urls import re_path, include

from .views.api import MachinePermissionsView, MemberViewSet
from .views.api import LogViewSet, MachineViewSet, LocationViewSet

router = DefaultRouter()
# router.register(r'permissions', PermissionViewSet, base_name='permission')
router.register(r'members', MemberViewSet)

logRouter = SimpleRouter(router)
logRouter.register(r'logs', LogViewSet, base_name='log-entries')

machineRouter = SimpleRouter(router)
machineRouter.register('machine', MachineViewSet)

locationRouter = SimpleRouter(router)
locationRouter.register('location', LocationViewSet)

machine_permissions_router = routers.NestedSimpleRouter(router,
                                                        r'members',
                                                        lookup='member')
machine_permissions_router.register(r'machines',
                                    MachinePermissionsView,
                                    base_name='member-machines')

urlpatterns = [
    re_path(r'', include(router.urls)),
    re_path(r'', include(machine_permissions_router.urls)),
Exemple #16
0
from rest_framework.routers import SimpleRouter

from rest_users.views import UserSignupViewSet, UserAuthViewSet, \
			UserPasswordResetViewSet, UserPasswordChangeViewSet, \
			UserTokenViewSet

user_router = SimpleRouter()
user_router.register("signup", UserSignupViewSet, "signup")
user_router.register("", UserAuthViewSet, "auth")
user_router.register("", UserPasswordChangeViewSet, "password-change")
user_router.register("", UserPasswordResetViewSet, "password-reset")
user_router.register("token", UserTokenViewSet, "user-token")

urlpatterns = user_router.urls
 def setUp(self):
     self.router = SimpleRouter()
Exemple #18
0
import django
from django.conf.urls import url
from project.organisations import views

from rest_framework.routers import SimpleRouter
from .views import OrganisationModelViewset

organisation_router = SimpleRouter()
organisation_router.register('organisation-model-viewsets',
                             OrganisationModelViewset,
                             base_name='organisation')

organisations_urlpatterns = [
    url(r'^create/$',
        view=views.CreateOrganisationView.as_view(),
        name="create"),
    url(r'^(?P<slug>[\w-]+)/$',
        view=views.RetrieveOrganisationView.as_view(),
        name="organisation"),
    url(r'^(?P<slug>[\w-]+)/members/$',
        view=views.OrganisationMembersView.as_view(),
        name="members"),
    url(r'^(?P<slug>[\w-]+)/leave/$',
        view=views.LeaveOrganisationView.as_view(),
        name="leave")
] + organisation_router.urls

members_urlpatterns = [
    url(r'^(?P<slug>[\w-]+)/members/$',
        view=views.OrganisationMembersView.as_view(),
        name="members"),
Exemple #19
0
from rest_framework.routers import SimpleRouter
from imdb_back.movies.views import GenresViewSet

genresRouter = SimpleRouter()
genresRouter.register(r'api/movies/genres', GenresViewSet)
Exemple #20
0
"""
Created at 11/07/20
@author: virenderkumarbhargav
"""
from __future__ import absolute_import

from django.conf.urls import url, include
# -*- coding: utf-8 -*-
from rest_framework.routers import SimpleRouter

from user import views

app_name = 'community'

router = SimpleRouter()  # pylint: disable=invalid-name
# router.register(r'users', views.UserViewSet, basename='users')

urlpatterns = [
    url(r'^', include(router.urls)),
]
Exemple #21
0
# encoding: utf-8
from __future__ import unicode_literals

from rest_framework.routers import SimpleRouter

from .views import AdditionalMaintenancesView, MaintenancesView

router = SimpleRouter(trailing_slash=False)
router.register('maintenances', MaintenancesView, base_name='maintenances')
router.register('additional-maintenances', AdditionalMaintenancesView,
                base_name='additional_maintenances')

urlpatterns = router.urls
Exemple #22
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter, SimpleRouter
from grandchallenge.retina_api import views
from django.views.decorators.cache import cache_page
from django.conf import settings

app_name = "retina_api"

annotation_router = SimpleRouter()
annotation_router.register(
    "singlepolygonannotation",
    views.SinglePolygonViewSet,
    basename="singlepolygonannotation",
)
annotation_router.register(
    "polygonannotationset",
    views.PolygonAnnotationSetViewSet,
    basename="polygonannotationset",
)
annotation_router.register(
    "etdrsgridannotation",
    views.ETDRSGridAnnotationViewSet,
    basename="etdrsgridannotation",
)
annotation_router.register(
    "imagequalityannotation",
    views.ImageQualityAnnotationViewSet,
    basename="imagequalityannotation",
)
annotation_router.register(
    "imagepathologyannotation",
Exemple #23
0
from django.urls import path, include
from rest_framework.routers import SimpleRouter

from api.expense.views.expense import ExpenseModelViewSet, QuantityExpenseModelViewSet

router = SimpleRouter()
router_two = SimpleRouter()

router.register('', ExpenseModelViewSet)
router_two.register('quantity', QuantityExpenseModelViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('add/', include(router_two.urls))
]
Exemple #24
0
    url(r'^statistical/goods_day_views/$', statistical.GoodsView.as_view()),

    url(r'^users/$', UserView.as_view()),

    url(r'^goods/simple/$', spu.SpuSimleView.as_view()),

    url(r'^goods/(?P<pk>\d+)/specs/$', specs.SpecOpTIONView.as_view()),

    url(r'^skus/categories/$', Cate3View.as_view()),

    url(r'^skus/simple/$', SKUSIMP.as_view()),
    url(r'^permission/simple/$', GroupLIView.as_view()),



]

ro  = SimpleRouter()
ro.register('goods/specs',specs.SpecViewSet,base_name='specs')

urlpatterns += ro.urls

router = DefaultRouter()
router.register('skus/images',ImageViewSet,base_name='images')
router.register('skus', SKUGoodsView, base_name='skus')
router.register('orders', OrderSet, base_name='orders')
router.register('permission/perms', PermissionView, base_name='PermissionView')
router.register('permission/groups', GroupView, base_name='PermissionView')
urlpatterns += router.urls
Exemple #25
0
from rest_framework.routers import SimpleRouter

from ..routers import OptionalSlashRouter
from . import viewsets

routerRegister = SimpleRouter()
routerRegister.register(r'',
                        viewsets.ProductorRegistrationAPIView,
                        basename='productor')

router = OptionalSlashRouter()
router.register(r'list(:?/(?P<productorName>.+))?',
                viewsets.ProductorListAPIView,
                basename='searchProductor')

urlpatterns = [] + router.urls
Exemple #26
0
from django.conf.urls import include, patterns, url

from rest_framework.routers import SimpleRouter

from mkt.abuse.views import (AppAbuseViewSet, ExtensionAbuseViewSet,
                             UserAbuseViewSet, WebsiteAbuseViewSet)

abuse = SimpleRouter()
abuse.register('user', UserAbuseViewSet, base_name='user-abuse')
abuse.register('app', AppAbuseViewSet, base_name='app-abuse')
abuse.register('website', WebsiteAbuseViewSet, base_name='website-abuse')
abuse.register('extension', ExtensionAbuseViewSet, base_name='extension-abuse')

api_patterns = patterns(
    '',
    url('^abuse/', include(abuse.urls)),
)
Exemple #27
0
from django.conf.urls import include, url

from rest_framework.routers import SimpleRouter
from rest_framework_nested.routers import NestedSimpleRouter

from olympia.bandwagon.views import CollectionViewSet, CollectionAddonViewSet

from . import views


accounts = SimpleRouter()
accounts.register(r'account', views.AccountViewSet, base_name='account')

collections = NestedSimpleRouter(accounts, r'account', lookup='user')
collections.register(r'collections', CollectionViewSet,
                     base_name='collection')
sub_collections = NestedSimpleRouter(collections, r'collections',
                                     lookup='collection')
sub_collections.register('addons', CollectionAddonViewSet,
                         base_name='collection-addon')

notifications = NestedSimpleRouter(accounts, r'account', lookup='user')
notifications.register(r'notifications', views.AccountNotificationViewSet,
                       base_name='notification')

urlpatterns = [
    url(r'^authenticate/$', views.AuthenticateView.as_view(),
        name='accounts.authenticate'),
    url(r'^login/start/$',
        views.LoginStartView.as_view(),
        name='accounts.login_start'),
Exemple #28
0
class NamingCollisionViewSet(GenericViewSet):
    """
    Example via: https://stackoverflow.com/questions/43778668/django-rest-framwork-occured-typeerror-link-object-does-not-support-item-ass/
    """
    permision_class = ()

    @list_route()
    def detail(self, request):
        return {}

    @list_route(url_path='detail/export')
    def detail_export(self, request):
        return {}


naming_collisions_router = SimpleRouter()
naming_collisions_router.register(r'collision',
                                  NamingCollisionViewSet,
                                  base_name="collision")


class TestURLNamingCollisions(TestCase):
    """
    Ref: https://github.com/encode/django-rest-framework/issues/4704
    """
    def test_manually_routing_nested_routes(self):
        patterns = [
            url(r'^test', simple_fbv),
            url(r'^test/list/', simple_fbv),
        ]
Exemple #29
0
# Copyright (c) 2017 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 3 (GPLv3). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
# along with this software; if not, see
# https://www.gnu.org/licenses/gpl-3.0.txt.
#
"""Describes the urls and patterns for the API application."""

from django.conf.urls import url
from rest_framework.routers import SimpleRouter
from rest_framework.urlpatterns import format_suffix_patterns
from api.views import (CredentialViewSet, FactViewSet, SourceViewSet,
                       ScanJobViewSet, ReportListView)

ROUTER = SimpleRouter()

ROUTER.register(r'credentials', CredentialViewSet, base_name='cred')
ROUTER.register(r'facts', FactViewSet, base_name='facts')
ROUTER.register(r'sources', SourceViewSet, base_name='source')
ROUTER.register(r'scans', ScanJobViewSet, base_name='scanjob')

# pylint: disable=invalid-name
urlpatterns = [url(r'^reports/$', ReportListView.as_view())]

urlpatterns = format_suffix_patterns(urlpatterns)

urlpatterns += ROUTER.urls
Exemple #30
0
from django.conf.urls import include, patterns, url

from rest_framework.routers import SimpleRouter

from . import views

addons = SimpleRouter()
addons.register(r'addon', views.AddonViewSet)

urlpatterns = patterns(
    '',
    url(r'', include(addons.urls)),
    url(r'^search/$', views.AddonSearchView.as_view(), name='addon-search'),
)