예제 #1
0
from django.urls import path
from rest_framework import routers
from api.views import( 
    UserCreateView, 
    PrescriptionView, 
    UserPrescriptionList,
    UserPrescriptionDetail,
)

router = routers.DefaultRouter(trailing_slash=True)
router.register("drugs", PrescriptionView, "prescription")

urlpatterns = [
    path("user/", UserCreateView.as_view(), name='user'),
    path("user/<int:user_id>/drugs/", UserPrescriptionList.as_view(), name="user_drug"),
    path("user/<int:user_id>/drugs/<int:pk>/", UserPrescriptionDetail.as_view(), name="user_drug_detail"),
]

urlpatterns += router.urls


'''
api/user/(GET) (POST)
api/user/:id (GET) (PUT) (DELETE)

api/user/:user_id/drugs/ (GET) (POST)
api/user/:user_id/drugs/:prescription_id (GET) (DELETE)
'''

예제 #2
0
    https://docs.djangoproject.com/en/1.8/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. 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.contrib import admin
from django.contrib.auth.decorators import login_required
from api.views import UrlRedirectView, UserCreateView, UrlCreationView, UserUrlListView

urlpatterns = [
    url(r'^$', UserUrlListView.as_view(), name="url_list"),
    url(r'^create_user/', UserCreateView.as_view(), name="create_user"),
    url(r'^create_url/$',
        login_required(UrlCreationView.as_view()),
        name="url_create"),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^new_url/(?P<short_url>\w+)',
        UrlRedirectView.as_view(),
        name="url_redirect"),
    url(r'^admin/', include(admin.site.urls)),
    #    url(r'^api/$', include('framework.urls')),
]
예제 #3
0
파일: urls.py 프로젝트: Mikodes/royale-plus
from django.conf.urls import url
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from rest_framework_jwt.views import obtain_jwt_token

from api.views import (
    UserViewSet,
    FollowViewSet,
    DeckViewSet,
    ActivityViewSet,
    CommentViewSet,
    UserCreateView,
    UserUpdateView,
)

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'follows', FollowViewSet)
router.register(r'decks', DeckViewSet)
router.register(r'activities', ActivityViewSet)
router.register(r'comments', CommentViewSet)

urlpatterns = router.urls
urlpatterns += [
    url(r'^docs/', include_docs_urls(title='Royale Clan API'), name='docs'),
    url(r'^auth/', obtain_jwt_token, name='auth'),
    url(r'^signup/', UserCreateView.as_view(), name='signup'),
    url(r'^settings/', UserUpdateView.as_view(), name='settings'),
]
예제 #4
0
from items import views
from django.conf import settings
from django.conf.urls.static import static
from api.views import ItemListView, ItemDetailView, UserCreateView
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('items/list/', views.item_list, name='item-list'),
    path('items/detail/<int:item_id>/', views.item_detail, name='item-detail'),
    path('items/wishlist/', views.wishlist, name='wishlist'),
    path('user/register/', views.user_register, name='user-register'),
    path('user/login/', views.user_login, name='user-login'),
    path('user/logout/', views.user_logout, name='user-logout'),
    path('items/<int:item_id>/favorite/',
         views.item_favorite,
         name='item-favorite'),
    path('api/login/', TokenObtainPairView.as_view(), name="api-login"),
    path('token/refresh/', TokenRefreshView.as_view(), name="token-refresh"),
    path('api/register/', UserCreateView.as_view(), name="api-register"),
    path('api/list/', ItemListView.as_view(), name='api-list'),
    path('api/<int:item_id>/detail/',
         ItemDetailView.as_view(),
         name='api-detail'),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #5
0
파일: urls.py 프로젝트: oshosanya/esusu-api
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
from django.contrib import admin
from django.urls import path, include
from api.views import UserCreateView, SavingsGroupView, SavingsGroupMemberView
from rest_framework import routers
from rest_framework.authtoken import views

savings_group_router = routers.DefaultRouter()
savings_group_router.register(r'', SavingsGroupView, base_name='')
savings_group_router.register(r'^(?P<savings_group>[0-9])/users',
                              SavingsGroupMemberView,
                              base_name='savings-group')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('register/', UserCreateView.as_view()),
    path('savings-group/', include(savings_group_router.urls)),
    path('get-token/', views.obtain_auth_token)
]
예제 #6
0
from rest_framework.routers import DefaultRouter
from api.views import (
    CrisisViewSet,
    ReportViewSet,
    ReportUpdateCreateView,
    OperatorAccountList,
    AccountDetailView,
    UserCreateView,
    UserLoginView,
    UserLogoutView,
    UserPasswordChangeView,
)

router = DefaultRouter()
router.register(r'crisis_reports', ReportUpdateCreateView)

urlpatterns = [
    url(r'^crisis_view/$', ReportViewSet.as_view(), name="crisis_view"),
    url(r'^crisis_type/$', CrisisViewSet.as_view(), name="crisis_type"),
    url(r'', include(router.urls)),
    url(r'^users/create$', UserCreateView.as_view(), name="create_account"),
    url(r'^users/login$', UserLoginView.as_view(), name="login"),
    url(r'users/logout$', UserLogoutView.as_view(), name="logout"),
    url(r'^users/tokenauth/', obtain_auth_token, name="get_token"),
    url(r'users/changepassword',
        UserPasswordChangeView.as_view(),
        name="change_password"),
    path('operators/', OperatorAccountList.as_view()),
    path('operators/<int:pk>/', AccountDetailView.as_view()),
]
예제 #7
0
EventListView,
UserCreateView,
EventUpdateView,
EventCreateView,
EventDetailView,
OrganizerEventsView,
MyBookingsView,
BookView,
)
from rest_framework_jwt.views import obtain_jwt_token



urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('events.urls')),
    path('api/list/', EventListView.as_view(), name='api-list'),
    path('api/signup/', UserCreateView.as_view(), name='api-signup'),
    path('api/signin/', obtain_jwt_token, name='api-signin'),
    path('api/create/', EventCreateView.as_view(), name='api-create'),
    path('api/update/<int:event_id>/', EventUpdateView.as_view(), name='api-update'),
    path('api/detail/<int:event_id>/', EventDetailView.as_view(), name='api-detail'),
    path('api/organizer/events/', OrganizerEventsView.as_view(), name='organizer-events'),
    path('api/mybookings/', MyBookingsView.as_view(), name='my-booking'),
    path('api/book/', BookView.as_view(), name='book'),
]


if settings.DEBUG:
    urlpatterns+=static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns+=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #8
0
from django.urls import path
from api.views import (UserCreateView, UserLoginView, UserLogoutView,
                       ContentCreateView, RelationCreateView,
                       RelationDeleteView, UserGetView)

urlpatterns = [
    path('v1/users/login/', UserLoginView.as_view(), name='api_v1_user_login'),
    path('v1/users/logout/',
         UserLogoutView.as_view(),
         name='api_v1_user_logout'),
    path('v1/users/create/',
         UserCreateView.as_view(),
         name='api_v1_user_create'),
    path('v1/users/get/', UserGetView.as_view(), name='api_v1_user_get'),
    path('v1/contents/create/',
         ContentCreateView.as_view(),
         name='api_v1_content_create'),
    path('v1/relation/create/',
         RelationCreateView.as_view(),
         name='api_v1_relation_create'),
    path('v1/relation/delete/',
         RelationDeleteView.as_view(),
         name='api_v1_relation_delete'),
]
예제 #9
0
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from api.views import (
    ProfileAPIView,
    UserCreateView,
    UserLoginView,
    YachtClubViewSet,
    YachtViewSet,
)

router = routers.DefaultRouter()
# router.register(r'users', UserViewSet)
# router.register(r'groups', GroupViewSet)
#router.register(r'profiles', ProfileAPIView)
router.register(r'yachtclubs', YachtClubViewSet)
router.register(r'yachts', YachtViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path(r'api/', include(router.urls)),
    path(r'api-auth/',
         include('rest_framework.urls', namespace='rest_framework')),
    path('register/', UserCreateView.as_view(), name='register'),
    path('login/', UserLoginView.as_view(), name='login'),
    path('profiles/', ProfileAPIView.as_view(), name='profile'),
    path('', include('www.urls', ))
]
예제 #10
0
"""urly_api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. 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.contrib import admin
from django.contrib.auth.decorators import login_required
from api.views import UrlRedirectView, UserCreateView, UrlCreationView, UserUrlListView

urlpatterns = [
    url(r'^$', UserUrlListView.as_view(), name="url_list"),
    url(r'^create_user/', UserCreateView.as_view(), name="create_user"),
    url(r'^create_url/$', login_required(UrlCreationView.as_view()), name="url_create"),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^new_url/(?P<short_url>\w+)', UrlRedirectView.as_view(), name="url_redirect"),
    url(r'^admin/', include(admin.site.urls)),
#    url(r'^api/$', include('framework.urls')),
]