Ejemplo n.º 1
0
"""main_project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    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 rest_framework_extensions.routers import ExtendedDefaultRouter
from news.api import views as events_views

router = ExtendedDefaultRouter()
router.register(r'events', events_views.EventsViewSet)


urlpatterns = [
    url(r'^api/', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^admin/', admin.site.urls),
]

Ejemplo n.º 2
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

from posts.views import PostViewSet
from threads.views import ThreadViewSet

router = ExtendedDefaultRouter()

thread_router = router.register('', ThreadViewSet, basename='threads')
thread_router.register(
    'posts',
    PostViewSet,
    basename='thread-post',
    parents_query_lookups=['thread',]
)

urlpatterns = router.urls
Ejemplo n.º 3
0
from django.conf import settings
from django.conf.urls import url, include
from rest_framework_extensions.routers import ExtendedDefaultRouter

import userprofile.api.views
import course.api.views
import exercise.api.views
import exercise.api.csv.views
import external_services.api.views

api = ExtendedDefaultRouter()

api.register(r'users', userprofile.api.views.UserViewSet, basename='user')

with api.register(r'courses',
                  course.api.views.CourseViewSet,
                  basename='course') as courses:
    courses.register(r'exercises',
                     course.api.views.CourseExercisesViewSet,
                     basename='course-exercises')
    courses.register(r'students',
                     course.api.views.CourseStudentsViewSet,
                     basename='course-students')
    courses.register(r'usertags',
                     course.api.views.CourseUsertagsViewSet,
                     basename='course-usertags')
    courses.register(r'taggings',
                     course.api.views.CourseUsertaggingsViewSet,
                     basename='course-taggings')
    courses.register(r'points',
                     exercise.api.views.CoursePointsViewSet,
Ejemplo n.º 4
0
from django.conf.urls import patterns, include, url
from rest_framework.routers import SimpleRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter
from . import views

router = ExtendedDefaultRouter()
(
    router.register(r'wordcounts', views.WordCountRootViewSet),
    router.register(r'feeds',
                    views.FeedViewSet,
                    base_name='feed')
          .register(r'entries',
                    views.EntryViewSet,
                    base_name='feeds-entry',
                    parents_query_lookups=['feed', ])
          .register(r'wordcounts',
                    views.WordCountViewSet,
                    base_name='feeds-entries-wordcount',
                    parents_query_lookups=['entry__feed', 'entry', ]),
    router.register(r'words', views.WordCountTopViewSet, base_name='words-top'),
)


additional_router = SimpleRouter()
additional_router.register(r'wordcounts/simple', views.WordCountSimpleViewSet, base_name='wordcounts-simple'),
additional_router.register(r'wordcounts/json', views.WordCountSimpleJsonViewSet, base_name='wordcounts-json'),


urlpatterns = patterns('',
    url(r'', include(additional_router.urls)),
    url(r'', include(router.urls)),
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
from django.conf.urls import include, patterns, url
from rest_framework_extensions.routers import ExtendedDefaultRouter as DefaultRouter
from odbx.api.views import accounts
from odbx.api.views.alarms import AlarmViewSet


router = DefaultRouter()

router.register(r'alarms', AlarmViewSet)


urlpatterns = patterns(
    '',
    url(r'^', include(router.urls)),
    url(r'^accounts/me/$', accounts.me),
)
Ejemplo n.º 6
0
from django.conf.urls import patterns, url, include
from django_project import views

from rest_framework_extensions.routers import ExtendedDefaultRouter

router = ExtendedDefaultRouter()
projects_router = router.register(r'projects', views.ProjectViewSet)
router.register(r'components', views.ComponentViewSet)
tasks_router = router.register(r'tasks', views.TaskViewSet)
users_router = router.register(r'users', views.UserViewSet)
milestones_router = router.register(r'milestones', views.MilestoneModelViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'comments', views.CommentModelViewSet)
router.register(r'notifications', views.NotificationModelViewSet)

router.register(r'tasktypes', views.TaskTypeViewSet)
router.register(r'priorities', views.PriorityViewSet)
router.register(r'statuses', views.StatusViewSet)

projects_router.register(r'members', views.UserViewSet, base_name='projects-member', parents_query_lookups=['membership'])
projects_router.register(r'milestones', views.MilestoneModelViewSet, base_name='projects-milestone', parents_query_lookups=['project'])
projects_router.register(r'components', views.ComponentViewSet, base_name='projects-component', parents_query_lookups=['project'])
projects_router.register(r'tasks', views.TaskViewSet, base_name='projects-task', parents_query_lookups=['project'])
projects_router.register(r'tasktypes', views.TaskTypeViewSet, base_name='projects-tasktype', parents_query_lookups=['project'])
projects_router.register(r'priorities', views.PriorityViewSet, base_name='projects-priority', parents_query_lookups=['project'])
projects_router.register(r'statuses', views.StatusViewSet, base_name='projects-status', parents_query_lookups=['project'])

milestones_router.register(r'tasks', views.TaskViewSet, base_name='milestones-task', parents_query_lookups=['milestone'])

users_router.register(r'tasks', views.TaskViewSet, base_name='users-task', parents_query_lookups=['owner'])
users_router.register(r'projects', views.ProjectViewSet, base_name='users-project', parents_query_lookups=['members'])
Ejemplo n.º 7
0
from django.conf.urls import url
from rest_framework_extensions.routers import ExtendedDefaultRouter

from api import views

router = ExtendedDefaultRouter(trailing_slash=False)
router.register("products", views.ProductViewSet, base_name="product")
router.register("rfes", views.RFEViewSet, base_name="rfe")
router.register("tests", views.TestViewSet, base_name="test_id")
router.register("job_results", views.JobResultViewSet, base_name="job_result")
router.register("upload", views.FileUploadView, base_name="file_upload")

urlpatterns = [
    url(r'^view/products$', views.view_products),
]

urlpatterns += router.urls
Ejemplo n.º 8
0
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter



# Create a router and register our viewsets with it.
from .generator import views
from rest_framework_extensions.routers import ExtendedDefaultRouter

router = ExtendedDefaultRouter()

router.register(r'generators', views.GeneratorViewSet)\
      .register(r'streams',
                views.StreamViewSet,
                base_name='stream',
                parents_query_lookups=['generator_pk'])\
      .register(r'protocols',
                views.ProtocolViewSet,
                base_name='protocol',
                parents_query_lookups=['generator_pk', 'stream_pk'])

router1 = ExtendedDefaultRouter()

router1.register(r'streams', views.StreamViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^', include(router1.urls)),
    # url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
Ejemplo n.º 9
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import AuthViewSet, AuthTokenViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

router.register(
    r'auth',
    AuthViewSet,
    base_name='auth',
)

router.register(
    r'auth',
    AuthTokenViewSet,
    base_name='auth',
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 10
0
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
# from rest_framework.routers import DefaultRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter
from authentication import views as av
from jobs import views as jv
from timesheet import views as tv


# Create a router and register our viewsets with it.
router = ExtendedDefaultRouter()
router.register(r'employers', av.EmployerViewSet)
router.register(r'employees', av.EmployeeViewSet)
router.register(r'industry', av.IndustryViewSet)
router.register(r'joblisttype', jv.JobListTypeViewSet)
router.register(r'job_draft', jv.DraftJobViewSet, base_name='job_draft')
router.register(r'job_active', jv.ActiveJobViewSet, base_name='job_active') \
    .register(r'applications',
              jv.ApplicationEmpViewSet,
              base_name='application',
              parents_query_lookups=['job_id']) \
    .register(r'applicants',
              jv.ApplicantsViewSet,
              base_name='applicant',
              parents_query_lookups=['application__job', 'application'])

router.register(r'jobs', jv.JobViewSet)
Ejemplo n.º 11
0
from django.conf.urls import include, url
from rest_framework_extensions.routers import ExtendedDefaultRouter
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token
from . import views

bookings_router = ExtendedDefaultRouter()

(bookings_router.register(r'bookables', views.BookableViewSet)
 .register(r'booking-parts', views.BookingPartViewSet, 'bookables-bookingpart', parents_query_lookups=['bookable']))
(bookings_router.register(r'bookings', views.BookingViewSet)
 .register(r'booking-parts', views.BookingPartViewSet, 'bookings-bookingpart', parents_query_lookups=['booking']))
bookings_router.register(r'booking-parts', views.BookingPartViewSet)

urlpatterns = [
    url(r'^auth/token/$', obtain_jwt_token),
    url(r'^auth/token/refresh/$', refresh_jwt_token),

    url(r'^user/', views.CurrentUserView.as_view()),
    url(r'^bookings/', include(bookings_router.urls)),
]
Ejemplo n.º 12
0
# -*- coding: utf-8 -*-
from rest_framework_extensions.routers import ExtendedDefaultRouter as DefaultRouter

from allmychanges.views_api import RepoViewSet, SubscriptionViewSet


router = DefaultRouter()
router.root_view_name = 'main_api_path'
router.register(r'repos', RepoViewSet, base_name='repo')
router.register(r'subscriptions', SubscriptionViewSet, base_name='repo')

urlpatterns = router.urls
Ejemplo n.º 13
0
from django.conf.urls import patterns, url, include
from damn_rest import views

from django.contrib import admin
admin.autodiscover()

from rest_framework_extensions.routers import ExtendedDefaultRouter

router = ExtendedDefaultRouter()

# Path router
paths_router = router.register(r'paths', views.PathViewSet)

# File router and its nested routes
files_router = router.register(r'files', views.FileReferenceViewSet)
files_router.register(r'assets', views.AssetReferenceViewSet, base_name='files-asset', parents_query_lookups=['file'])

# Asset router and its nested routes
assets_router = router.register(r'assets', views.AssetReferenceViewSet)
assets_router.register(r'revisions', views.AssetRevisionsViewSet, base_name='assetreferences-revision', parents_query_lookups=['asset'])

# ReferenceTask router
router.register(r'referencetasks', views.ReferenceTasksViewSet, base_name='referencetasks')

import django_project
from django_project.urls import router as routerp
from django_project.urls import projects_router

# Project router and its nested routes
projects_router.register(r'files', views.FileReferenceViewSet, base_name='projects-filereference', parents_query_lookups=['project'])
projects_router.register(r'assets', views.AssetReferenceViewSet, base_name='projects-assetreference', parents_query_lookups=['file__project'])
Ejemplo n.º 14
0
from django.conf.urls import url, include
# Create a router and register our viewsets with it.
from .generator import views as generator_views
from .switch import views as switch_views
from rest_framework_extensions.routers import ExtendedDefaultRouter


nested_router = ExtendedDefaultRouter()

nested_router.register(r'generators',
                       generator_views.GeneratorViewSet,
                       base_name='generator')\
             .register(r'streams',
                       generator_views.StreamViewSet,
                       base_name='stream',
                       parents_query_lookups=['generator_pk'])\
             .register(r'protocols',
                       generator_views.ProtocolViewSet,
                       base_name='protocol',
                       parents_query_lookups=['generator_pk', 'stream_pk'])


nested_router.register(r'switches',
                       switch_views.SwitchViewSet,
                       base_name='switch')\
             .register(r'vlans',
                       switch_views.VLANViewSet,
                       base_name='vlan',
                       parents_query_lookups=['switch_pk'])

urlpatterns = [
Ejemplo n.º 15
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

from mysite import viewsets as mysite_viewsets
from writing import viewsets as writing_viewsets
from rest_friendship import viewsets as friendship_viewsets

me_router = ExtendedDefaultRouter()
me_router.register(r'document',
                   mysite_viewsets.MeDocumentViewSet,
                   base_name='me-writer-document')
me_router.register(r'shared',
                   mysite_viewsets.MeSharedDocumentModelViewSet,
                   base_name='me-writer-shared-document')
me_router.register(r'friend',
                   mysite_viewsets.MeFriendModelViewSet,
                   base_name='me-friends')
me_router.register(r'friendship-to-user',
                   mysite_viewsets.MeFriendshipToUserModelViewSets,
                   base_name='me-friendship-to-user')
me_router.register(r'friendship-from-user',
                   mysite_viewsets.MeFriendshipFromUserModelViewSets,
                   base_name='me-friendship-from-user')
me_router.register(r'friendship-request-to-user',
                   mysite_viewsets.MeFriendshipToUserRequestViewSet,
                   base_name='me-friendship-request-to-user')
me_router.register(r'friendship-request-from-user',
                   mysite_viewsets.MeFriendshipFromUserRequestViewSet,
                   base_name='me-friendship-request-from-user')
me_router.register(r'follower',
                   mysite_viewsets.MeFollowFollowerModelViewSet,
                   base_name='me-follower')
Ejemplo n.º 16
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import RedirectView
from rest_framework_extensions.routers import ExtendedDefaultRouter

from seed.blog.api import views as blog_api_views
from seed.search.api.views import PostSearchView

router = ExtendedDefaultRouter()

router.register(r'author', blog_api_views.AuthorViewSet, base_name='author')
router.register(r'category', blog_api_views.CategoryViewSet, base_name='category')
router.register(r'tag', blog_api_views.TagViewSet, base_name='tag')
router.register(r'post', blog_api_views.PostViewSet, base_name='post')

urlpatterns = [
    url(r'^$', RedirectView.as_view(url='/api/v1.0/')),
    url(r'^admin/', admin.site.urls),
    url(r'^api/v1.0/', include(router.urls)),
    url(r'^api/search/posts/', PostSearchView.as_view(), name='search-posts'),
]
Ejemplo n.º 17
0
from django.urls import path, include
from rest_auth.urls import urlpatterns as rest_patterns
from rest_framework_extensions.routers import (
    ExtendedDefaultRouter as DefaultRouter
)

from . import views

router = DefaultRouter()

# user_router = router.register(
#     r'user', views.UserViewSet, 'user'
# )

user_notes_router = router.register(
    r'user/notes', views.UserNoteViewSet, 'user_notes'
)

user_notifications_router = router.register(
    r'user/notifications', views.UserNotificationsViewSet, 'user_notifications'
)

user_notification_settings_router = router.register(
    r'user/notification/settings', views.UserNotificationSettingViewSet, 'user_notification_settings'
)
accounts_urls = list(url for url in rest_patterns if url.name != 'rest_user_details')
user_urls = list(url for url in rest_patterns if url.name == 'rest_user_details')
urlpatterns = [
    path(r"accounts/verify-email/", views.VerifyEmailView.as_view(),
         name="account_confirm_email"),
    path(r"accounts/verify-email/<key>/", views.ConfirmEmailView.as_view(),
Ejemplo n.º 18
0
from django.conf.urls import url
from rest_framework_extensions.routers import ExtendedDefaultRouter
from gymmy_app import viewsets


router = ExtendedDefaultRouter()

trainees = router.register(r'trainees', viewsets.TraineeViewSet, base_name='trainees')
trainees.register(r'personal-progresses', viewsets.PersonalProgressViewSet, base_name='trainee-personal-progress', parents_query_lookups=['trainee'])
trainees.register(r'training-plans', viewsets.TrainingPlanViewSet, base_name='trainee-training-plans', parents_query_lookups=['trainee'])

router.register(r'gyms', viewsets.GymViewSet, base_name='gyms')

router.register(r'exercises', viewsets.ExerciseViewSet, base_name='exercises')

router.register(r'gym-machines', viewsets.GymMachineViewSet, base_name='gym-machines')

training_planes = router.register(r'training-plans', viewsets.TrainingPlanViewSet, base_name='training-plans')
training_planes.register('exercise-details', viewsets.TrainingPlanExerciseDetailViewSet, base_name='training-plans-exercies-details', parents_query_lookups=['training_plan'])

router.register(r'personal-progresses', viewsets.PersonalProgressViewSet, base_name='personal-progresses')

router.register(r'training-plan-exercise-details', viewsets.TrainingPlanExerciseDetailViewSet, base_name='training-plan-exercise-details')

router.register(r'training-plan-exercise-progresses', viewsets.TrainingPlanExerciseProgressViewSet, base_name='training-plan-exercise-progresse')


urlpatterns = router.urls

urlpatterns += [url(r'user-log-in/', viewsets.LogInApiView.as_view(), name='user_log_in')]
Ejemplo n.º 19
0
from django.urls import path, include
from rest_framework_extensions.routers import ExtendedDefaultRouter

from . import views

router = ExtendedDefaultRouter()

(router.register(r"projects", views.ProjectViewSet,
                 basename="project").register(
                     r"floors",
                     views.FloorViewSet,
                     basename="projects-floor",
                     parents_query_lookups=["project_id"],
                 ).register(
                     r"rooms",
                     views.RoomViewSet,
                     basename="projects-floors-room",
                     parents_query_lookups=["floor__project", "floor_id"],
                 ))

urlpatterns = [path(r"", include(router.urls))]
Ejemplo n.º 20
0
from django.conf import settings
from django.conf.urls import url, include
from rest_framework_extensions.routers import ExtendedDefaultRouter

import userprofile.api.views
import course.api.views
import exercise.api.views
import exercise.api.csv.views
import external_services.api.views


api = ExtendedDefaultRouter()

api.register(r'users',
             userprofile.api.views.UserViewSet,
             base_name='user')

with api.register(r'courses',
                  course.api.views.CourseViewSet,
                  base_name='course') as courses:
    courses.register(r'exercises',
                     course.api.views.CourseExercisesViewSet,
                     base_name='course-exercises')
    courses.register(r'students',
                     course.api.views.CourseStudentsViewSet,
                     base_name='course-students')
    courses.register(r'usertags',
                     course.api.views.CourseUsertagsViewSet,
                     base_name='course-usertags')
    courses.register(r'taggings',
                     course.api.views.CourseUsertaggingsViewSet,
Ejemplo n.º 21
0
from django.views.generic.base import RedirectView
# =============================================================================
from rest_framework.routers import DefaultRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter
# =============================================================================
import shibsso
# =============================================================================
from lhcbpr_api import views
# =============================================================================
#admin.autodiscover()
# =============================================================================
router = ExtendedDefaultRouter()
default_router = DefaultRouter()
# =============================================================================

router.register(r'applications', views.ApplicationViewSet)
router.register(r'versions', views.ApplicationVersionViewSet)
router.register(r'executables', views.ExecutableViewSet)
router_options = router.register(r'options', views.OptionViewSet)
router.register(r'groups', views.AttributeGroupViewSet)
router.register(r'attributes', views.AttributeViewSet)
router.register(r'setups', views.SetupProjectViewSet)
router_jd = router.register(r'descriptions', views.JobDescriptionViewSet)
router.register(r'thresholds', views.AttributeThresholdViewSet)
router.register(r'handlers', views.HandlerViewSet)
router.register(r'platforms', views.PlatformViewSet)
router.register(r'hosts', views.HostViewSet)
router.register(r'results', views.JobResultViewSet)
# =============================================================================

router_jobs = router.register(r'jobs', views.JobViewSet, base_name='job')
Ejemplo n.º 22
0
from django.contrib import admin
from django.conf.urls import patterns, include, url
from rest_framework_extensions.routers import ExtendedDefaultRouter

from api import views


router = ExtendedDefaultRouter(trailing_slash=False)
router.register(r"servers", views.ServerView)\
      .register(r"processes", views.ServerProcessView, base_name="server-processes", parents_query_lookups=['server'])

router.register(r"stats", views.StatsView)


urlpatterns = patterns('',
    url(r'^social/', include('social.apps.django_app.urls', namespace='social')),
    url(r'^$', 'angularjs.views.index'),
    url(r'^token$', 'angularjs.views.token'),
    url(r'^api-login', 'rest_framework.authtoken.views.obtain_auth_token', name='get-token'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^docs/', include('rest_framework_swagger.urls')),
    url(r'^api/', include(router.urls)),
)
Ejemplo n.º 23
0
    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.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path, include, re_path
from rest_framework_extensions.routers import ExtendedDefaultRouter

from thread import views


router = ExtendedDefaultRouter()
(
    router.register(r"api/v1/posts", views.PostViewSet).register(
        r"comments",
        views.CommentViewSet,
        basename="post-comments",
        parents_query_lookups=["related_post"],
    )
)


urlpatterns = (
    [
        path("admin/", admin.site.urls),
        re_path(
            r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")
        ),
    ]
    + router.urls
    + staticfiles_urlpatterns()
)
Ejemplo n.º 24
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import Version_informationViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

router.register(
    r'code',
    Version_informationViewSet,
    base_name='code',
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 25
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import *

router = ExtendedDefaultRouter()

# Maintenance subsystem
router.register(r'maintenance', MaintenanceViewSet, base_name='maintenance')
# Wallets administration
wallets_router = router.register(r'agent/admin/wallets',
                                 AdminWalletViewSet,
                                 base_name='admin-wallets')
# Readonly Ledger
ledger_router_readonly = router.register(r'agent/ledger',
                                         LedgerReadOnlyViewSet,
                                         base_name='ledger')
# Verifier
verify_router = router.register(r'agent/verify',
                                VerifyViewSet,
                                base_name='verify')

# Wallet pairwise discovery
pairwise_router = wallets_router.register(r'pairwise',
                                          PairwiseViewSet,
                                          base_name='wallets-pairwise',
                                          parents_query_lookups=['wallet'])
# DID manage
did_router = wallets_router.register(r'did',
                                     DIDViewSet,
                                     base_name='wallets-did',
                                     parents_query_lookups=['wallet'])
Ejemplo n.º 26
0
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

from rest_framework_extensions.routers import ExtendedDefaultRouter

api_router = ExtendedDefaultRouter()


# CustomUser app
from custom_user.views import UserViewSet

api_router.register(r'users', UserViewSet)


# Cal App
from cal.views import EventViewSet, CalendarViewSet, EventInvitationViewSet

api_router.register(r'calendars', CalendarViewSet)\
    .register(r'events', EventViewSet, base_name='calendars-event',
              parents_query_lookups=['calendar__events'])
api_router.register(r'invitations', EventInvitationViewSet)
Ejemplo n.º 27
0
from django.conf.urls import url
from django.urls import include
from rest_framework_extensions.routers import (
    ExtendedDefaultRouter as DefaultRouter
)

from .views import UserPointsViewSet

router = DefaultRouter()

categories_router = router.register(
    r'user/points', UserPointsViewSet, 'user_points'
)

urlpatterns = [
    url(r'', include(router.urls))
]
Ejemplo n.º 28
0
from django.conf.urls import url, include
from . import views
from rest_framework.routers import DefaultRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter

# Create a router and register our viewsets with it.
router = ExtendedDefaultRouter()
(
    router.register(r"rosters", views.RosterViewSet, base_name="roster")
    .register(r"duties", views.DutyViewSet, base_name="roster-duty", parents_query_lookups=["roster"])
    .register(
        r"dutyitems",
        views.DutyItemViewSet,
        base_name="roster-duty-duty_item",
        parents_query_lookups=["duty_segment__duty__roster", "duty_segment__duty"],
    )
)
# router = DefaultRouter()
# router.register(r'rosters', views.RosterViewSet)
router.register(r"duties", views.DutyViewSet, base_name="duty")
router.register(r"dutyitems", views.DutyItemViewSet, base_name="duty_item")


# The API URLs are now determined automatically by the router.
urlpatterns = [url(r"^", include(router.urls))]
Ejemplo n.º 29
0
    SitewideMessageViewSet,
    AuthorizedApplicationUserViewSet,
    OneTimeAuthenticationKeyViewSet,
    UserCollectionSubscriptionViewSet,
    TokenView,
)

from kpi.views import home, one_time_login, browser_tests
from kobo.apps.reports.views import ReportsViewSet
from kobo.apps.superuser_stats.views import user_report, retrieve_user_report
from kpi.views import authorized_application_authenticate_user
from kpi.forms import RegistrationForm
from hub.views import switch_builder

router = ExtendedDefaultRouter()
asset_routes = router.register(r'assets', AssetViewSet)
asset_routes.register(r'versions',
                      AssetVersionViewSet,
                      base_name='asset-version',
                      parents_query_lookups=['asset'],
                      )
asset_routes.register(r'submissions',
                      SubmissionViewSet,
                      base_name='submission',
                      parents_query_lookups=['asset'],
                      )


router.register(r'asset_snapshots', AssetSnapshotViewSet)
router.register(
    r'collection_subscriptions', UserCollectionSubscriptionViewSet)
Ejemplo n.º 30
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import ClassificationViewSet, SubjectViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

classifications_routes = router.register(
    r'classifications',
    ClassificationViewSet,
    base_name='classification',
)

subjects_routes = router.register(
    r'subjects',
    SubjectViewSet,
    base_name='subject',
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 31
0
from django.conf.urls import url
from django.urls import include
from rest_framework_extensions.routers import (ExtendedDefaultRouter as
                                               DefaultRouter)

from .views import SeminarsViewSet, DiscussionsViewSet, DiscussionsRegistrationViewSet, SeminarRegistrationViewSet

router = DefaultRouter()

seminars_registration_router = router.register(
    r'activities/seminars/registration', SeminarRegistrationViewSet,
    'seminars_registration')
discussions_registration_router = router.register(
    r'activities/discussions/registration', DiscussionsRegistrationViewSet,
    'discussions_registration')
seminars_router = router.register(r'activities/seminars', SeminarsViewSet,
                                  'seminars')
discussions_router = router.register(r'activities/discussions',
                                     DiscussionsViewSet, 'discussions')

urlpatterns = [url(r'', include(router.urls))]
Ejemplo n.º 32
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import TermOfUserViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

router.register(
    r'term_of_use',
    TermOfUserViewSet,
    base_name='term_of_use',
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 33
0
from hikster.hike.views import (
    EventTrailSectionViewSet,
    EventViewSet,
    Trail3DViewSet,
    TrailSectionViewSet,
    TrailViewSet,
)
from hikster.location.views import LocationViewSet, PointOfInterestViewSet
from hikster.mailing.views import ReservationMailView
from hikster.organizations.views import OrganizationViewSet
from hikster.search.views import SearchView


trail_routes = ExtendedDefaultRouter()
trail_routes.register(r"trails", TrailViewSet, basename="trail")


trail3d_routes = ExtendedDefaultRouter()
trail3d_routes.register(r"3d-trails", Trail3DViewSet, basename="trail-3d")


location_routes = ExtendedDefaultRouter()

location_routes.register(
    r"locations", LocationViewSet,
    basename="location"
).register(
    r"trails",
    TrailViewSet,
    basename="location-trails",
Ejemplo n.º 34
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import MobileVerificationCodeViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

router.register(
    r'code',
    MobileVerificationCodeViewSet,
    base_name='code',
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 35
0
from django.views.generic.base import RedirectView
# =============================================================================
from rest_framework.routers import DefaultRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter
# =============================================================================
import shibsso
# =============================================================================
from lhcbpr_api import views
# =============================================================================
#admin.autodiscover()
# =============================================================================
router = ExtendedDefaultRouter()
default_router = DefaultRouter()
# =============================================================================

router.register(r'applications', views.ApplicationViewSet)
router.register(r'versions', views.ApplicationVersionViewSet)
router.register(r'executables', views.ExecutableViewSet)
router_options = router.register(r'options', views.OptionViewSet)
router.register(r'groups', views.AttributeGroupViewSet)
router.register(r'attributes', views.AttributeViewSet)
router.register(r'setups', views.SetupProjectViewSet)
router_jd = router.register(r'descriptions', views.JobDescriptionViewSet)
router.register(r'thresholds', views.AttributeThresholdViewSet)
router.register(r'handlers', views.HandlerViewSet)
router.register(r'platforms', views.PlatformViewSet)
router.register(r'hosts', views.HostViewSet)
router.register(r'results', views.JobResultViewSet)
# =============================================================================

router_jobs = router.register(r'jobs', views.JobViewSet, base_name='job')
Ejemplo n.º 36
0
"""Tenants URLconf."""
# Copyright 2015 Solinea, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from rest_framework_extensions.routers import ExtendedDefaultRouter
from .views import TenantsViewSet, UserViewSet, CloudViewSet

# Views handled by DjangoRestFramework ViewSets, with drf-extensions help.
router = ExtendedDefaultRouter()

tenants_routes = router.register(r"tenants", TenantsViewSet, base_name="tenants")  # pylint: disable=C0103
tenants_routes.register(r"users", UserViewSet, base_name="tenants-users", parents_query_lookups=["tenant"])

tenants_routes.register(r"cloud", CloudViewSet, base_name="tenants-cloud", parents_query_lookups=["tenant"])

urlpatterns = router.urls
Ejemplo n.º 37
0
from .views import (
    AccountViewSet,
    PasswordViewSet,
    UserViewSet,
    AddressViewSet,
    LanguageViewSet,
    ImageViewSet,
    VideoViewSet,
    InstructorViewSet,
)

router = ExtendedDefaultRouter(trailing_slash=False)

router.register(
    r'account',
    AccountViewSet,
    base_name='account',
)

router.register(
    r'password',
    PasswordViewSet,
    base_name='password',
)

users_routes = router.register(
    r'users',
    UserViewSet,
    base_name='user',
)
Ejemplo n.º 38
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import (
    UserViewSet,
    GroupViewSet,
    PermissionViewSet,
)


router = ExtendedDefaultRouter()
# nested routes
(
    router.register(r'users', UserViewSet)
          .register(r'groups', GroupViewSet, 'users-group', parents_query_lookups=['user_groups'])
          .register(r'permissions', PermissionViewSet, 'users-groups-permission', parents_query_lookups=['group__user', 'group'])
)
# simple routes
router.register(r'groups', GroupViewSet, 'group')
router.register(r'permissions', PermissionViewSet, 'permission')

urlpatterns = router.urls
Ejemplo n.º 39
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

# from rest_framework_friendship import views
from core import viewsets as core_viewsets
from writing import viewsets as writing_viewsets
from rest_friendship import viewsets as friendship_viewsets

router = ExtendedDefaultRouter()

router.register(r'profile/search',
                core_viewsets.ProfileSearchViewSet,
                base_name='profile-search')
# profile_router = router.register(r'profile', viewsets.ProfileDetailViewSets, 'profile')

# me1_router = router.register('friendship', friendship_viewsets.FriendshipViewSet,base_name='my_friendship')
# me_router = router.register(r'me', core_viewsets.MeProfileModelViewSets, base_name='me')
# me_router = router.register(r'me', writing_viewsets.MeWriterModelViewSet, base_name='me')
# me_router.register(r'writer', writing_viewsets.MeWriterModelViewSet, base_name='me-writer', parents_query_lookups='user__profile__uuid')
Ejemplo n.º 40
0
from django.conf.urls import url
from rest_framework_extensions.routers import ExtendedDefaultRouter
from flurryapp import viewsets


router = ExtendedDefaultRouter()

router.register(r'data-drivers', viewsets.DataDriverViewSet, base_name='datadriver')\
    .register(r'drivers', viewsets.DriverViewSet,  base_name='data-drivers-driver', parents_query_lookups=['data_driver'])

router.register(r'users', viewsets.UserViewSet, base_name='users')\
    .register(r'drivers', viewsets.DriverViewSet, base_name='user-drivers', parents_query_lookups=['user'])

drivers_router = router.register(r'drivers', viewsets.DriverViewSet, base_name='drivers')

urlpatterns = router.urls

urlpatterns += [url(r'user-log-in/', viewsets.UserLogInAPIViewSet.as_view(), name='user_log_in')]
Ejemplo n.º 41
0
from django.conf.urls import patterns, include, url

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .views import CityViewSet, DistrictViewSet

router = ExtendedDefaultRouter(trailing_slash=False)

cities_routes = router.register(
    r'cities',
    CityViewSet,
    base_name='city',
)

cities_routes.register(
    r'districts',
    DistrictViewSet,
    base_name='district',
    parents_query_lookups=['city'],
)

urlpatterns = patterns('',
    url(r'', include(router.urls)),
)
Ejemplo n.º 42
0
# coding: utf-8

from rest_framework_extensions.routers import ExtendedDefaultRouter

from .api import {{ cookiecutter.service_slug|capitalize }}ViewSet


router = ExtendedDefaultRouter()
(
    router.register(r"{{ cookiecutter.service_slug }}", {{ cookiecutter.service_slug|capitalize }}ViewSet,
                    base_name="{{ cookiecutter.service_slug }}"),
)

urlpatterns = router.urls
Ejemplo n.º 43
0
from django.conf.urls import patterns, url, include
from django_project import views

from rest_framework_extensions.routers import ExtendedDefaultRouter

router = ExtendedDefaultRouter()
projects_router = router.register(r'projects', views.ProjectViewSet)
router.register(r'components', views.ComponentViewSet)
tasks_router = router.register(r'tasks', views.TaskViewSet)
users_router = router.register(r'users', views.UserViewSet)
milestones_router = router.register(r'milestones', views.MilestoneModelViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'comments', views.CommentModelViewSet)
router.register(r'notifications', views.NotificationModelViewSet)

router.register(r'tasktypes', views.TaskTypeViewSet)
router.register(r'priorities', views.PriorityViewSet)
router.register(r'statuses', views.StatusViewSet)

projects_router.register(r'members',
                         views.UserViewSet,
                         base_name='projects-member',
                         parents_query_lookups=['membership'])
projects_router.register(r'milestones',
                         views.MilestoneModelViewSet,
                         base_name='projects-milestone',
                         parents_query_lookups=['project'])
projects_router.register(r'components',
                         views.ComponentViewSet,
                         base_name='projects-component',
                         parents_query_lookups=['project'])
Ejemplo n.º 44
0
from kpi.views.v2.asset_file import AssetFileViewSet
from kpi.views.v2.asset_permission_assignment import AssetPermissionAssignmentViewSet
from kpi.views.v2.asset_snapshot import AssetSnapshotViewSet
from kpi.views.v2.asset_version import AssetVersionViewSet
from kpi.views.v2.collection import CollectionViewSet
from kpi.views.v2.collection_permission_assignment import CollectionPermissionAssignmentViewSet
from kpi.views.v2.data import DataViewSet

from kpi.views.v2.permission import PermissionViewSet
from kpi.views.v2.user import UserViewSet


URL_NAMESPACE = 'api_v2'

router_api_v2 = ExtendedDefaultRouter()
asset_routes = router_api_v2.register(r'assets', AssetViewSet, basename='asset')

asset_routes.register(r'files',
                      AssetFileViewSet,
                      basename='asset-file',
                      parents_query_lookups=['asset'],
                      )

asset_routes.register(r'permission-assignments',
                      AssetPermissionAssignmentViewSet,
                      basename='asset-permission-assignment',
                      parents_query_lookups=['asset'],
                      )

asset_routes.register(r'versions',
                      AssetVersionViewSet,
Ejemplo n.º 45
0
from django.conf.urls import url
from django.urls import include
from rest_framework_extensions.routers import (ExtendedDefaultRouter as
                                               DefaultRouter)

from .views import PaymentsViewSet

router = DefaultRouter()

payments_router = router.register(r'payments', PaymentsViewSet, 'payments')

urlpatterns = [url(r'', include(router.urls))]
Ejemplo n.º 46
0
    queryset = Image.objects.all()
    serializer_class = ImageSerializer


class CustomObtainAuthToken(ObtainAuthToken):
    def post(self, request, *args, **kwargs):
        response = super(CustomObtainAuthToken,
                         self).post(request, *args, **kwargs)
        token = Token.objects.get(key=response.data['token'])
        return Response({'token': token.key, 'id': token.user_id})


router = ExtendedDefaultRouter()
router.register('api/posts', PostViewSet,
                basename='posts').register('comments',
                                           CommentViewSet,
                                           basename='posts-comments',
                                           parents_query_lookups=['post'])
router.register('api/comments', CommentViewSet)

router.register('api/users', UserViewSet, basename='users').register(
    'posts',
    PostViewSet,
    basename='users-posts',
    parents_query_lookups=['user']).register(
        'comments',
        CommentViewSet,
        basename='user-comments',
        parents_query_lookups=['post__user', 'post'])

router.register('api/follows', FollowViewSet, basename='follow')
Ejemplo n.º 47
0
from django.urls import path, include

from rest_framework_extensions.routers import ExtendedDefaultRouter

from classes.api.v1 import viewsets

router = ExtendedDefaultRouter()

class_router = router.register(r"", viewsets.ClassViewSet, basename="classes")

students_router = class_router.register(
    r"students",
    viewsets.ClassStudentViewSet,
    basename="class-students",
    parents_query_lookups=["student__classes"],
)
video_router = class_router.register(
    r"videos",
    viewsets.ClassVideoViewSet,
    basename="class-videos",
    parents_query_lookups=["uploaded_class"],
)

comment_router = video_router.register(
    r"comments",
    viewsets.ClassVideoCommentViewSet,
    basename="class-video-comments",
    parents_query_lookups=["video__uploaded_class", "video"],
)

urlpatterns = [
Ejemplo n.º 48
0
from rest_framework_extensions.routers import ExtendedDefaultRouter

from boards.views import BoardViewSet
from threads.views import ThreadViewSet

router = ExtendedDefaultRouter()

board_router = router.register('', BoardViewSet, basename='boards')
board_router.register('threads',
                      ThreadViewSet,
                      basename='boards-threads',
                      parents_query_lookups=[
                          'board',
                      ])

urlpatterns = router.urls
Ejemplo n.º 49
0
Archivo: urls.py Proyecto: siturra/kpi
from kpi.views import home, one_time_login, browser_tests
from kobo.apps.reports.views import ReportsViewSet
from kobo.apps.superuser_stats.views import user_report, retrieve_user_report
from kpi.views import authorized_application_authenticate_user
from kpi.views import custom_login
from kpi.forms import RegistrationForm
from hub.views import switch_builder
from hub.models import ConfigurationFile
from kobo.apps.hook.views import HookViewSet, HookLogViewSet

# TODO: Give other apps their own `urls.py` files instead of importing their
# views directly! See
# https://docs.djangoproject.com/en/1.8/intro/tutorial03/#namespacing-url-names

router = ExtendedDefaultRouter()
asset_routes = router.register(r'assets', AssetViewSet, base_name='asset')
asset_routes.register(
    r'versions',
    AssetVersionViewSet,
    base_name='asset-version',
    parents_query_lookups=['asset'],
)
asset_routes.register(
    r'submissions',
    SubmissionViewSet,
    base_name='submission',
    parents_query_lookups=['asset'],
)
asset_routes.register(
    r'files',
    AssetFileViewSet,
Ejemplo n.º 50
0
from django.urls import include, path
from rest_framework_extensions.routers import ExtendedDefaultRouter

from flows.views import FlowResponseViewSet, FlowViewSet

v1router = ExtendedDefaultRouter()
flow_router = v1router.register("flow-results/packages",
                                FlowViewSet,
                                basename="flow")
flow_router.register(
    "responses",
    FlowResponseViewSet,
    basename="flowresponse",
    parents_query_lookups=["question__flow"],
)

urlpatterns = [
    path("api/v1/", include(v1router.urls)),
]
Ejemplo n.º 51
0
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from rest_framework_extensions.routers import ExtendedDefaultRouter
from .views import TenantsViewSet, UserViewSet, CloudViewSet

# Views handled by DjangoRestFramework ViewSets, with drf-extensions help.
router = ExtendedDefaultRouter()

tenants_routes = router.register(
    r'tenants',  # pylint: disable=C0103
    TenantsViewSet,
    base_name="tenants")
tenants_routes.register(r'users',
                        UserViewSet,
                        base_name="tenants-users",
                        parents_query_lookups=["tenant"])

tenants_routes.register(r'cloud',
                        CloudViewSet,
                        base_name="tenants-cloud",
                        parents_query_lookups=["tenant"])

urlpatterns = router.urls
Ejemplo n.º 52
0
from rest_framework.viewsets import ViewSet
from rest_framework_extensions.routers import ExtendedDefaultRouter
# from rest_framework_nested import routers as NestedRouter


from classroom import viewsets
# from problem import viewsets as problem_viewsets


router = ExtendedDefaultRouter()
# router = NestedRouter.DefaultRouter()

sensei_router = router.register(r'teacher', viewsets.TeacherModelViewSets, 'teacher')
# sensei_router.register(r'exams',
#                        viewsets.ExamProblemsModelViewSet,
#                        base_name='sensei-exams',
#                        parents_query_lookups=['teacher'])

pupil_router = router.register(r'student', viewsets.StudentModelViewSets, 'student')
# pupil_router.register(r'exams',
#                       viewsets.ExamAnswerModelViewSet,
#                       base_name='pupil-exams',
#                       parents_query_lookups=['student'])
class_router = router.register(r'class', viewsets.ClassModelViewSet, 'class')
class_router.register(r'students',
                      viewsets.StudentModelViewSets,
                      base_name='class-student',
                      parents_query_lookups=['class'])
class_router.register(r'teachers',
                      viewsets.TeacherModelViewSets,
                      base_name='class-teacher',
Ejemplo n.º 53
0
from django.urls import include, path

from rest_framework_extensions.routers import ExtendedDefaultRouter

from ..viewsets import (CatalogViewSet, MembershipViewSet,
                        ProjectMembershipViewSet, ProjectSnapshotViewSet,
                        ProjectValueViewSet, ProjectViewSet,
                        QuestionSetViewSet, SnapshotViewSet, ValueViewSet)

app_name = 'v1-projects'

router = ExtendedDefaultRouter()
project_route = router.register(r'projects',
                                ProjectViewSet,
                                basename='project')
project_route.register(r'memberships',
                       ProjectMembershipViewSet,
                       basename='project-membership',
                       parents_query_lookups=['project'])
project_route.register(r'snapshots',
                       ProjectSnapshotViewSet,
                       basename='project-snapshot',
                       parents_query_lookups=['project'])
project_route.register(r'values',
                       ProjectValueViewSet,
                       basename='project-value',
                       parents_query_lookups=['project'])
router.register(r'snapshots', SnapshotViewSet, basename='snapshot')
router.register(r'values', ValueViewSet, basename='value')
router.register(r'memberships', MembershipViewSet, basename='membership')
router.register(r'questionsets', QuestionSetViewSet, basename='questionset')
Ejemplo n.º 54
0
from django.contrib import admin
from django.conf.urls import patterns, include, url
from rest_framework_extensions.routers import ExtendedDefaultRouter

from api import views

router = ExtendedDefaultRouter(trailing_slash=False)
router.register(r"servers", views.ServerView)\
      .register(r"processes", views.ServerProcessView, base_name="server-processes", parents_query_lookups=['server'])

router.register(r"stats", views.StatsView)

urlpatterns = patterns(
    '',
    url(r'^social/', include('social.apps.django_app.urls',
                             namespace='social')),
    url(r'^$', 'angularjs.views.index'),
    url(r'^token$', 'angularjs.views.token'),
    url(r'^api-login',
        'rest_framework.authtoken.views.obtain_auth_token',
        name='get-token'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^docs/', include('rest_framework_swagger.urls')),
    url(r'^api/', include(router.urls)),
)
Ejemplo n.º 55
0
from kpi.views.v2.asset_permission_assignment import AssetPermissionAssignmentViewSet
from kpi.views.v2.asset_snapshot import AssetSnapshotViewSet
from kpi.views.v2.asset_version import AssetVersionViewSet
from kpi.views.v2.data import DataViewSet
from kpi.views.v2.export_task import ExportTaskViewSet
from kpi.views.v2.user_asset_subscription import UserAssetSubscriptionViewSet

from kpi.views.v2.permission import PermissionViewSet
from kpi.views.v2.user import UserViewSet
from kpi.views.v2.import_task import ImportTaskViewSet


URL_NAMESPACE = 'api_v2'

router_api_v2 = ExtendedDefaultRouter()
asset_routes = router_api_v2.register(r'assets', AssetViewSet, basename='asset')

asset_routes.register(r'files',
                      AssetFileViewSet,
                      basename='asset-file',
                      parents_query_lookups=['asset'],
                      )

asset_routes.register(r'permission-assignments',
                      AssetPermissionAssignmentViewSet,
                      basename='asset-permission-assignment',
                      parents_query_lookups=['asset'],
                      )

asset_routes.register(r'versions',
                      AssetVersionViewSet,
Ejemplo n.º 56
0
from rest_framework.viewsets import ViewSet
from rest_framework_extensions.routers import ExtendedDefaultRouter
# from rest_framework_nested import routers as NestedRouter


from classroom import viewsets
from problem import viewsets as problem_viewsets


router = ExtendedDefaultRouter()
# router = NestedRouter.DefaultRouter()

sensei_router = router.register(r'sensei', viewsets.SenseiModelViewSets, 'sensei')
sensei_router.register(r'exams',
                       viewsets.ExamProblemsModelViewSet,
                       basename='sensei-exams',
                       parents_query_lookups=['teacher'])

pupil_router = router.register(r'pupil', viewsets.PupilModelViewSets, 'pupil')
pupil_router.register(r'exams',
                      viewsets.ExamAnswerModelViewSet,
                      basename='pupil-exams',
                      parents_query_lookups=['student'])
class_router = router.register(r'class', viewsets.ClassModelViewSet, 'class')
class_router.register(r'students',
                      viewsets.PupilModelViewSets,
                      basename='class-pupil',
                      parents_query_lookups=['class'])
class_router.register(r'teachers',
                      viewsets.SenseiModelViewSets,
                      basename='class-sensei',
Ejemplo n.º 57
0
from django.urls import include, path
from django.contrib import admin
# from rest_framework import routers
from tutorial.quickstart import views
from tutorial.quickstart.router import SwitchDetailRouter
from rest_framework_extensions.routers import ExtendedDefaultRouter
from tutorial.quickstart.views import FollowViewSet

switch_router = SwitchDetailRouter()
router = ExtendedDefaultRouter()
user_router = router.register(r'users', views.UserViewSet)

user_router.register('tweets', views.UserTweetViewSet, 'user-tweets',
                     ['username'])
user_router.register('follows', views.UserFollowsViewSet, 'user-follows',
                     ['username'])
user_router.register('followed', views.UserFollowedViewSet, 'user-followers',
                     ['username'])

router.register(r'tweets', views.TweetViewSet)
switch_router.register(r'follow', FollowViewSet)
router.register(r'feed', views.FeedViewSet)

urlpatterns = [
    path('v1/', include(switch_router.urls)),
    path('v1/', include(router.urls)),
    path('admin/', admin.site.urls),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework'))
]
Ejemplo n.º 58
0
router.register(r'videos', VideoViewSet)
router.register(r'captions', CaptionViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
]"""

from rest_framework_extensions.routers import ExtendedDefaultRouter as Router

from api.viewsets import VideoViewSet, CaptionViewSet

router = Router()
(
    router
        .register(r'videos',
                  VideoViewSet,
                  base_name='video')
        .register(r'captions',
                  CaptionViewSet,
                  base_name='videos-caption',
                  parents_query_lookups=['video_caption'])
)

router.register(r'captions',
                CaptionViewSet,
                base_name='caption')

urlpatterns = router.urls