Exemple #1
0
/monster-instances/
/monster-instances/<id>
/rune-instances/
/rune-instances/<id>
"""

router = DefaultRouter()
router.register(r'profiles', SummonerViewSet, base_name='profiles')
router.register(r'monster-instances',
                GlobalMonsterInstanceViewSet,
                base_name='monster-instances')
router.register(r'rune-instances',
                GlobalRuneInstanceViewSet,
                base_name='rune-instances')

profile_router = NestedDefaultRouter(router, r'profiles', lookup='user')
profile_router.register(r'monsters',
                        MonsterInstanceViewSet,
                        base_name='profile/monsters')
profile_router.register(r'monster-pieces',
                        MonsterPieceViewSet,
                        base_name='profile/monster-pieces')
profile_router.register(r'runes',
                        RuneInstanceViewSet,
                        base_name='profile/runes')
profile_router.register(r'rune-crafts',
                        RuneCraftInstanceViewSet,
                        base_name='profile/rune-crafts')
profile_router.register(r'buildings',
                        BuildingViewSet,
                        base_name='profile/buildings')
Exemple #2
0
from django.conf.urls import url
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from rest_framework_nested.routers import NestedDefaultRouter

from order import views

router = DefaultRouter(trailing_slash=False)
router.register("orders", views.OrdersViewSet, basename="orders")

orders_router = NestedDefaultRouter(router, r"orders", lookup="order")
orders_router.register(r"items",
                       views.OrderItemsModelViewSet,
                       basename="items")

urlpatterns = [
    url(r"^", include(router.urls)),
    url(r"^", include(orders_router.urls)),
    path(r"raw-orders", views.raw_order),
    path(r"raw-orders/<int:pk>", views.raw_order_id)
]
Exemple #3
0
from rest_framework_nested.routers import DefaultRouter, NestedDefaultRouter
from . import views

router = DefaultRouter()
router.register('hot', views.HotArticleViewSet, base_name='hot-article')
router.register('topic', views.TopicArticleViewSet, base_name='topic-article')
router.register('archive', views.ArchiveViewSet, base_name='archive')
router.register('', views.ArticleViewSet, base_name='article')

article_router = NestedDefaultRouter(router, '', lookup='article')
article_router.register(r'comment',
                        views.ArticleCommentViewSet,
                        base_name='article-comment')

urlpatterns = []

urlpatterns += router.urls + article_router.urls
from django.conf.urls.static import static

from rest_framework.routers import DefaultRouter
from rest_framework_nested.routers import NestedDefaultRouter
from lostboard.views.posts_view import PostsView
from lostboard.views.posts.comments_view import CommentsView as PostsCommentsView
from lostboard.views.comments_view import CommentsView
from lostboard.views.comments.comments_view import CommentsView as CommentsCommentsView

app_name = 'lostboard'

# base 이름은 view의 단축이름을 만들때 사용한다.
posts_router = DefaultRouter(trailing_slash=False)
posts_router.register(r'posts', PostsView, basename='posts')
posts_comments_router = NestedDefaultRouter(posts_router,
                                            r'posts',
                                            lookup='post')
posts_comments_router.register(r'comments',
                               PostsCommentsView,
                               basename='posts_comments')

# lookup에 _pk가 붙여져진다
comments_router = DefaultRouter(trailing_slash=False)
comments_router.register(r'comments', CommentsView, basename='comments')
comments_comments_router = NestedDefaultRouter(comments_router,
                                               r'comments',
                                               lookup='comment')
comments_comments_router.register(r'comments',
                                  CommentsCommentsView,
                                  basename='comments_comments')
Exemple #5
0
            # csrf check to simplify client code
            r.append(url("^" + cls.name + "/", cls.as_view()))
        else:
            _build_urls(cls, r)
    return r


router = DefaultRouter(trailing_slash=True)
router.include_format_suffixes = False
router.register("users", rest.UsersViewSet)
router.register("projects", rest.ProjectsViewSet)
router.register("series", rest.SeriesViewSet, base_name="series")
router.register("messages", rest.MessagesViewSet)

projects_router = NestedDefaultRouter(router,
                                      "projects",
                                      lookup="projects",
                                      trailing_slash=True)
projects_router.include_format_suffixes = False
projects_router.register("results",
                         rest.ProjectResultsViewSet,
                         base_name="results")
projects_router.register("series",
                         rest.ProjectSeriesViewSet,
                         base_name="series")
projects_router.register("messages",
                         rest.ProjectMessagesViewSet,
                         base_name="messages")

results_router = NestedDefaultRouter(projects_router,
                                     "series",
                                     lookup="series",
Exemple #6
0
from rest_framework_nested.routers import DefaultRouter, NestedDefaultRouter

from schools.views import SchoolViewSet
from students.views import StudentViewSet

router = DefaultRouter(trailing_slash=True)
router.register('schools', SchoolViewSet, basename='school')
router.register('students', StudentViewSet, basename='student')

students_router = NestedDefaultRouter(router, 'schools', lookup='school')
students_router.register('students',
                         StudentViewSet,
                         basename='school_students')

urlpatterns = []
urlpatterns += router.urls
urlpatterns += students_router.urls
Exemple #7
0
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

from accounts.views import CustomUserAddSkillView, CustomUserRemoveSkillView, CustomUserSearchView
from projects.views import ProjectViewSet, ProjectMembershipViewSet, ProjectMembershipRequestViewSet

schema_view = get_schema_view(
    openapi.Info(title="teamfinderr", default_version="v1"),
    public=True,
)

router = DefaultRouter()
router.register(r"requests", ProjectMembershipRequestViewSet)
router.register(r"projects", ProjectViewSet)

projects_router = NestedDefaultRouter(router, r"projects", lookup="project")
projects_router.register(r"memberships",
                         ProjectMembershipViewSet,
                         basename="project-memberships")

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api-auth/", include("rest_framework.urls")),
    path("api/v1/auth/", include("dj_rest_auth.urls")),
    path("api/v1/auth/user/add-skill/",
         CustomUserAddSkillView.as_view(),
         name="user-add-skill"),
    path("api/v1/auth/user/remove-skill/",
         CustomUserRemoveSkillView.as_view(),
         name="user-remove-skill"),
    path("api/v1/auth/registration/",
Exemple #8
0
from django.urls import path, include
from django.conf import settings
from rest_framework_nested.routers import DefaultRouter, NestedDefaultRouter
from rest_framework_swagger.views import get_swagger_view

from accounts.views import UserViewSets, MeView
from evacuation.views import ShelterViewSets, EvacuationHistoryViewSets, EvacuationViewSets, DemoEvacuationHistoryViewSets
from disaster.views import LocationView, DemoLocationView

router = DefaultRouter()
router.register(r'users', UserViewSets, basename='users')
router.register(r'shelters', ShelterViewSets, basename='shelters')
router.register(r'demo-shelters', ShelterViewSets, basename='demo-shelters')

shelter_nested_router = NestedDefaultRouter(router,
                                            'shelters',
                                            lookup='shelter')
shelter_nested_router.register(r'history',
                               EvacuationHistoryViewSets,
                               basename='history')
shelter_nested_router.register(r'evacuate',
                               EvacuationViewSets,
                               basename='evacuate')

demo_shelter_nested_serializer = NestedDefaultRouter(router,
                                                     'demo-shelters',
                                                     lookup='shelter')
demo_shelter_nested_serializer.register('history',
                                        DemoEvacuationHistoryViewSets,
                                        basename='history')
Exemple #9
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework_nested.routers import NestedDefaultRouter

from . import views


router = DefaultRouter()
router.register('order', views.OrderView, basename='order')

order_router = NestedDefaultRouter(router, 'order', lookup='order')
order_router.register('requests', views.DoerRequestView,
                      basename='order-requests')

urlpatterns = [
    path('order/', views.index),
    path('api/', include(router.urls)),
    path('api/', include(order_router.urls)),
]
Exemple #10
0
router.register(r'casestudies', login_views.CaseStudyViewSet)
router.register(r'keyflows', KeyflowViewSet)
router.register(r'products', AllProductViewSet)
router.register(r'wastes', AllWasteViewSet)
router.register(r'materials', AllMaterialViewSet)
router.register(r'publications', PublicationView)
router.register(r'reasons', ReasonViewSet)
router.register(r'sustainabilities', SustainabilityFieldViewSet)
router.register(r'impactcategories', ImpactcategoryViewSet)
router.register(r'targetvalues', TargetValueViewSet)
router.register(r'targetspecialreference', TargetSpatialReferenceViewSet)

router.register(r'processes', ProcessViewSet)

# /casestudies/...
cs_router = NestedDefaultRouter(router, r'casestudies', lookup='casestudy')
cs_router.register(r'users', login_views.UserInCasestudyViewSet)
cs_router.register(r'stakeholdercategories', StakeholderCategoryViewSet)
cs_router.register(r'chartcategories', ChartCategoryViewSet)
cs_router.register(r'keyflows', KeyflowInCasestudyViewSet)
cs_router.register(r'layercategories', LayerCategoryViewSet)
cs_router.register(r'levels', AdminLevelViewSet)
cs_router.register(r'areas', AreaViewSet)
cs_router.register(r'publications', PublicationInCasestudyViewSet)
cs_router.register(r'aims', AimViewSet)
cs_router.register(r'challenges', ChallengeViewSet)
cs_router.register(r'wmsresources', WMSResourceInCasestudyViewSet)
cs_router.register(r'sections', SectionViewSet)
cs_router.register(r'consensuslevels', ConsensusViewSet)

# /casestudies/*/layercategories/...
Exemple #11
0
            # csrf check to simplify client code
            r.append(url(cls.name + "/", cls.as_view()))
        else:
            _build_urls(cls, r)
    return r


router = DefaultRouter(trailing_slash=True)
router.include_format_suffixes = False
router.register('users', rest.UsersViewSet)
router.register('projects', rest.ProjectsViewSet)
router.register('projects/by-name', rest.ProjectsByNameViewSet)
router.register('series', rest.SeriesViewSet, base_name='series')
router.register('messages', rest.MessagesViewSet)

projects_router = NestedDefaultRouter(router, 'projects', lookup='projects', trailing_slash=True)
projects_router.include_format_suffixes = False
projects_router.register('results', rest.ProjectResultsViewSet, base_name='results')
projects_router.register('series', rest.ProjectSeriesViewSet, base_name='series')
projects_router.register('messages', rest.ProjectMessagesViewSet, base_name='messages')

results_router = NestedDefaultRouter(projects_router, 'series', lookup='series', trailing_slash=True)
results_router.include_format_suffixes = False
results_router.register('results', rest.SeriesResultsViewSet, base_name='results')

schema_view = get_schema_view(title='API schema')

urlpatterns = _build_urls() + [
    url(r"v1/", include(router.urls)),
    url(r"v1/", include(projects_router.urls)),
    url(r"v1/", include(results_router.urls)),
Exemple #12
0
            # csrf check to simplify client code
            r.append(url(cls.name + "/", cls.as_view()))
        else:
            _build_urls(cls, r)
    return r


router = DefaultRouter(trailing_slash=True)
router.include_format_suffixes = False
router.register('users', rest.UsersViewSet)
router.register('projects', rest.ProjectsViewSet)
router.register('series', rest.SeriesViewSet, base_name='series')
router.register('messages', rest.MessagesViewSet)

projects_router = NestedDefaultRouter(router,
                                      'projects',
                                      lookup='projects',
                                      trailing_slash=True)
projects_router.include_format_suffixes = False
projects_router.register('results',
                         rest.ProjectResultsViewSet,
                         base_name='results')
projects_router.register('series',
                         rest.ProjectSeriesViewSet,
                         base_name='series')
projects_router.register('messages',
                         rest.ProjectMessagesViewSet,
                         base_name='messages')

results_router = NestedDefaultRouter(projects_router,
                                     'series',
                                     lookup='series',
Exemple #13
0
from link_generator.api_viewsets import ProjectViewSet, LinkPackViewSet, ChangePasswordViewSet

# from . import views

router = DefaultRouter()
# router.register(r'projects/(?P<pid>[^/.]+)/linkpacks', LinkPackViewSet, base_name='linkpacks')
# router.register(r'linkpacks', LinkPackViewSet, base_name='linkpacks')
# router.register(r'projects/:project_id/linkpacks/', LinkPackViewSet, base_name='linkpacks')
router.register(r'projects', ProjectViewSet)
# router.register(r'change_password', ChangePasswordViewSet, base_name='change_password')

# router.register(r'qqq', LinkSetViewSet, base_name='qqq')
# router.register(r'users', UserViewSet)

linkpack_router = NestedDefaultRouter(router, r'projects', lookup='project')
linkpack_router.register(r'linkpacks',
                         LinkPackViewSet,
                         base_name='project-linkpacks')

# linkset_router = NestedDefaultRouter(linkpack_router, r'linkpacks', lookup='linkpack')
# linkset_router.register(r'linkset', LinkSetViewSet, base_name='project-linkpacks-linkset')

urlpatterns = [
    # path('', views.index, name='index'),
    path('change_password/', ChangePasswordViewSet.as_view()),
    path('', include(router.urls)),
    path('', include(linkpack_router.urls)),
    # path('api/', include(linkset_router.urls)),
    path('api-token-auth/', obtain_jwt_token),
    path('api-token-verify/', verify_jwt_token),
Exemple #14
0
/profile/<username>/runes/<id>
/profile/<username>/artifacts/
/profile/<username>/artifacts/<id>
/profile/<username>/rune-builds/
/profile/<username>/rune-builds/id
/profile/<username>/rune-crafts/
/profile/<username>/rune-crafts/<id>
/profile/<username>/teams/
/profile/<username>/teams/<id>
"""

router = DefaultRouter()
router.register(r'profiles/upload', ProfileJsonUpload, basename='profile/upload')
router.register(r'profiles/sync', SyncData, basename='sync-profile')
router.register(r'profiles/accepted-commands', SyncAcceptedCommands, basename='sync-accepted-commands')
router.register(r'profiles', SummonerViewSet, basename='profiles')

profile_router = NestedDefaultRouter(router, r'profiles', lookup='user')
profile_router.register(r'monsters', MonsterInstanceViewSet, basename='profile/monsters')
profile_router.register(r'monster-pieces', MonsterPieceViewSet, basename='profile/monster-pieces')
profile_router.register(r'runes', RuneInstanceViewSet, basename='profile/runes')
profile_router.register(r'artifacts', ArtifactInstanceViewSet, basename='profile/artifacts')
profile_router.register(r'rune-builds', RuneBuildViewSet, basename='profile/rune-builds')
profile_router.register(r'rune-crafts', RuneCraftInstanceViewSet, basename='profile/rune-crafts')
profile_router.register(r'buildings', BuildingViewSet, basename='profile/buildings')
profile_router.register(r'team-groups', TeamGroupViewSet, basename='profile/team-groups')
profile_router.register(r'teams', TeamViewSet, basename='profile/teams')
profile_router.register(r'upload', ProfileJsonUpload, basename='profile/upload_legacy')
profile_router.register(r'storage', StorageViewSet, basename='profile/storage')
profile_router.register(r'monster-shrine', MonsterShrineStorageViewSet, basename='profile/monster-shrine')
Exemple #15
0
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework_nested.routers import NestedDefaultRouter

from cars import views as cars_views

router = DefaultRouter()
router.register(r'cars', cars_views.CarMakesViewSet, basename='cars')
# /cars/
# /cars/{make}
# CarMakesViewSet' action 'popular':
# /cars/popular/
cars_router = NestedDefaultRouter(router, r'cars', lookup='car')
cars_router.register(r'models',
                     cars_views.CarModelsViewSet,
                     basename='car-models')
# /cars/{car_make}/models/
# /cars/{car_make}/models/{name}
# CarModelsViewSet's action 'rate':
# /cars/{car_make}/models/{name}/rate/

urlpatterns = [
    path('', include(router.urls)),
    path('', include(cars_router.urls)),
]
Exemple #16
0
router.register(r'positions', employees_views.PositionViewSet)
# generates:
# /positions/
# /positions/{pk}
router.register(r'employees', employees_views.EmployeeViewSet)
# generates:
# /employees/
# /employees/{abbreviation}

router.register(r'schedules',
                schedules_views.SchedulesViewSet,
                basename='schedules')
# generates:
# /schedules/
# /schedules/{slug}
schedules_router = NestedDefaultRouter(router, r'schedules', lookup='schedule')
schedules_router.register(r'modules',
                          modules_views.ModuleViewSet,
                          basename='modules')
# generates:
# /schedules/{schedule_slug}/modules/
# /schedules/{schedule_slug}/modules/{module_code}
modules_router = NestedDefaultRouter(schedules_router,
                                     r'modules',
                                     lookup='module')
modules_router.register(r'classes',
                        modules_views.ClassViewSet,
                        basename='classes')
# generates:
# /schedules/{schedule_slug}/modules/{module_module_code}/classes/
# /schedules/{schedule_slug}/modules/{module_module_code}/classes/{name}
Exemple #17
0
router.register(r'products', AllProductViewSet)
router.register(r'wastes', AllWasteViewSet)
router.register(r'materials', AllMaterialViewSet)
router.register(r'publications', PublicationView)
router.register(r'reasons', ReasonViewSet)
router.register(r'sustainabilities', SustainabilityFieldViewSet)
router.register(r'impactcategories', ImpactcategoryViewSet)
router.register(r'targetvalues', TargetValueViewSet)
router.register(r'targetspecialreference', TargetSpatialReferenceViewSet)
router.register(r'areasofprotection', AreaOfProtectionViewSet)
router.register(r'processes', ProcessViewSet)

## nested routes (see https://github.com/alanjds/drf-nested-routers) ##
# / sustainabilities/../
sus_router = NestedDefaultRouter(router,
                                 r'sustainabilities',
                                 lookup='sustainability')
sus_router.register(r'areasofprotection', AreaOfProtectionViewSet)
sus_router.register(r'impactcategories', ImpactCategoryInSustainabilityViewSet)

# /casestudies/...
cs_router = NestedDefaultRouter(router, r'casestudies', lookup='casestudy')
cs_router.register(r'users', login_views.UserInCasestudyViewSet)
cs_router.register(r'stakeholdercategories', StakeholderCategoryViewSet)
cs_router.register(r'chartcategories', ChartCategoryViewSet)
cs_router.register(r'keyflows', KeyflowInCasestudyViewSet)
cs_router.register(r'layercategories', LayerCategoryViewSet)
cs_router.register(r'levels', AdminLevelViewSet)
cs_router.register(r'areas', AreaViewSet)
cs_router.register(r'publications', PublicationInCasestudyViewSet)
cs_router.register(r'aims', AimViewSet)
from django.conf.urls import url, include
from rest_framework import routers
from rest_framework_nested.routers import NestedSimpleRouter, NestedDefaultRouter

from ovp.apps.projects import views

router = routers.DefaultRouter()
router.register(r'projects', views.ProjectResourceViewSet, 'project')
router.register(r'categories', views.CategoryResourceViewSet, 'category')

applies = NestedDefaultRouter(router, r'projects', lookup='project')
applies.register(r'applies', views.ApplyResourceViewSet, 'project-applies')

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^', include(applies.urls)),
]