示例#1
0
    def test_put_request(self):
        factory = APIRequestFactory()
        view = UserDetailsView.as_view()
        token, created = Token.objects.get_or_create(user=self.user)
        data = {
            'username': '******',
            'email': '*****@*****.**',
            # Pk not object
            'countries': (self.country_one.pk, self.country_two.pk),
            'home': self.country_two.pk,  # Pk not object
            'biography': 'Hi World!'
        }
        url = reverse('rest_user_details')
        request = factory.put('/api/v1/rest-auth/user/', data)
        force_authenticate(request, user=self.user, token=self.user.auth_token)
        response = view(request)
        self.assertEqual(response.status_code, 200)
        self.user.refresh_from_db()
        self.assertEqual(self.user.username, 'Test')
        self.assertEqual(self.user.email, '*****@*****.**')
        self.assertEqual(self.user.countries.all().count(), 2)
        self.assertEqual(self.user.home, self.country_two)

        # When the data is POSTed with full objects instead of just their pk,
        # it returns 400 bad request.
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'countries': (self.country_one, self.country_two),
            'home': self.country_one,
            'biography': 'Hi World!'
        }
        url = reverse('rest_user_details')
        request = factory.put(url, data)
        force_authenticate(request, user=self.user, token=self.user.auth_token)
        response = view(request)
        self.assertEqual(response.status_code, 400)

        # Country with pk=3 does not exist.
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'countries': (1, 2, 3),
            'home': 3,
            'biography': 'Hi World!'
        }
        url = reverse('rest_user_details')
        request = factory.put(url, data)
        force_authenticate(request, user=self.user, token=self.user.auth_token)
        response = view(request)
        self.assertEqual(response.status_code, 400)
示例#2
0
from django.urls import path
from rest_auth.views import UserDetailsView, PasswordChangeView

from core.api.viewsets import CustomRegisterView

urlpatterns = [
    path('register/', CustomRegisterView.as_view(), name='rest_register'),
    path('user/', UserDetailsView.as_view(), name='rest_user_details'),
    path('password/change/',
         PasswordChangeView.as_view(),
         name='rest_password_change'),
]
示例#3
0
 url(r'^accounts/', include('allauth.urls')),
 url(r'api/', include(router.urls)),
 url(r'^api/auth/register/account-confirm-email/(?P<key>\w+)/$',
     ConfirmEmailView.as_view(),
     name='account_confirm_email'),
 url(r'^api/auth/register/', include('rest_auth.registration.urls')),
 url(r'^api/auth/verify/', VerifyUserView.as_view(), name='auth-verify'),
 url(r'^api/auth/visitor/', EmailVisitorView.as_view(),
     name='auth-visitor'),
 url(r'^api/auth/jwt/token/', obtain_jwt_token),
 url(r'^api/auth/jwt/refresh/', refresh_jwt_token),
 url(r'^api/auth/jwt/verify/', verify_jwt_token),
 url(r'^api/oauth/',
     include('oauth2_provider.urls', namespace='oauth2_provider')),
 url(r'^api/me/account/', AccountInfoView.as_view(), name='account-info'),
 url(r'^api/me/user/', UserDetailsView.as_view(), name='user-info'),
 url(r'^api/me/profile/', ProfileView.as_view(), name='profile-info'),
 url(r'^api/me/company/', CompanyView.as_view(), name='company-info'),
 url(r'^api/me/settings/', UserSettingsView.as_view(),
     name='user-settings'),
 url(r'^api/me/notification/',
     NotificationView.as_view(),
     name='user-notifications'),
 url(r'^api/me/app/(?P<provider>\w+)/repos/$',
     RepoListView.as_view(),
     name="repo-list"),
 url(r'^api/me/app/(?P<provider>\w+)/issues/$',
     IssueListView.as_view(),
     name="issue-list"),
 url(r'^api/me/app/slack/$',
     SlackIntegrationView.as_view(),
示例#4
0
"""server URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.urls import include
from rest_auth.views import (LogoutView, UserDetailsView)

from server.trees.views import TreeView, TreeListView, TreeCreateView, TreeDestroyView

urlpatterns = {
    url(r'^api/', include(('timed_auth_token.urls', 'timed_auth_token'), namespace='auth'), name='login'),
    url(r'^api/logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/user/$', UserDetailsView.as_view(), name='user_details'),
    url(r'^api/tree/(?P<pk>\d+)$', TreeView.as_view(), name='tree_detail'),
    url(r'^api/tree/(?P<pk>\d+)/del$', TreeDestroyView.as_view(), name='tree_delete'),
    url(r'^api/trees/$', TreeListView.as_view(), name='tree_list'),
    url(r'^api/tree/$', TreeCreateView.as_view(), name='tree_save'),
}
示例#5
0
文件: urls.py 项目: SmirnovsIgor/TP
from django.urls import path
from rest_auth.views import UserDetailsView
from rest_framework.routers import DefaultRouter

from apps.subscriptions.views import SubscriptionMeViewSet
from apps.users import views

router = DefaultRouter()
router.register(r'', views.UserDataForStaffViewSet, basename='user')

userpatterns = [
    path('me/', UserDetailsView.as_view()),
    path('me/events/', views.UserEventsViewSet.as_view({'get': 'list'})),
    path('me/events/<str:event_id>/', views.UserEventsViewSet.as_view({'get': 'retrieve'})),
    path('me/subscriptions/', SubscriptionMeViewSet.as_view({'get': 'list'})),
]

userpatterns += router.urls

organizationpatterns = [
    path('', views.OrganizationsViewSet.as_view({'get': 'list'})),
    path('<str:organization_id>/', views.OrganizationsViewSet.as_view({'get': 'retrieve'})),
    path('<str:organization_id>/detailed/', views.OrganizationsViewSet.as_view({'get': 'detailed'})),
    path('<str:pk>/reviews/', views.OrganizationsViewSet.as_view({'get': 'reviews'})),
]
示例#6
0
        path('api/license/', LicenseAPIView.as_view()),
        path('api/installed/', InstalledAPIView.as_view()),
        path('api/setup/install/', InitializeDatabaseAPIView.as_view()),
        path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
    ]
    # URL for rest-auth
    urlpatterns += [
        # URLs that do not require a session or valid token
        re_path(r'^rest-auth/password/reset/$', PasswordResetView.as_view(),
            name='rest_password_reset'),
        re_path(r'^rest-auth/password/reset/confirm/$', PasswordResetConfirmView.as_view(),
            name='rest_password_reset_confirm'),
        re_path(r'^rest-auth/login/$', LoginView.as_view(), name='rest_login'),
        # URLs that require a user to be logged in with a valid session / token.
        re_path(r'^rest-auth/logout/$', LogoutView.as_view(), name='rest_logout'),
        re_path(r'^rest-auth/user/$', UserDetailsView.as_view(), name='rest_user_details'),
        re_path(r'^rest-auth/password/change/$', PasswordChangeView.as_view(),
            name='rest_password_change'),
    ]

if settings.DEBUG:
    urlpatterns += [
        path('admin/', admin.site.urls),
    ]

# Add final wildcard route to catch the deep links
# into the frontend SPA
urlpatterns += [
    path('<path:spa_path>', IndexTemplateView.as_view()),
    # This needs to be below in order to allow for the system to generate
    # the Password reset confirmation URL
示例#7
0
    # URL for rest-auth
    urlpatterns += [
        # URLs that do not require a session or valid token
        re_path(r'^rest-auth/password/reset/$',
                PasswordResetView.as_view(),
                name='rest_password_reset'),
        re_path(r'^rest-auth/password/reset/confirm/$',
                PasswordResetConfirmView.as_view(),
                name='rest_password_reset_confirm'),
        re_path(r'^rest-auth/login/$', LoginView.as_view(), name='rest_login'),
        # URLs that require a user to be logged in with a valid session / token.
        re_path(r'^rest-auth/logout/$',
                LogoutView.as_view(),
                name='rest_logout'),
        re_path(r'^rest-auth/user/$',
                UserDetailsView.as_view(),
                name='rest_user_details'),
        re_path(r'^rest-auth/password/change/$',
                PasswordChangeView.as_view(),
                name='rest_password_change'),
    ]

if settings.DEBUG:
    urlpatterns += [
        path('admin/', admin.site.urls),
    ]

# Add final wildcard route to catch the deep links
# into the frontend SPA
urlpatterns += [
    path('<path:spa_path>', IndexTemplateView.as_view()),
示例#8
0
from index.building.views import BuildingViewSet
from index.flow.views import FlowViewSet
from rest_auth.views import (
    LoginView,
    LogoutView,
    PasswordChangeView,
    UserDetailsView,
)

rest_auth_urls = [
    url(r'^login/$', LoginView.as_view(), name='rest_login'),
    url(r'^logout/$', LogoutView.as_view(), name='rest_logout'),
    url(r'^password/change/$',
        PasswordChangeView.as_view(),
        name='rest_password_change'),
    url(r'^user/$', UserDetailsView.as_view(), name='user'),
]

router = routers.DefaultRouter()
router.register(r'discipline', DisciplineViewSet, basename='Discipline')
router.register(r'education_plan',
                EducationPlanViewSet,
                basename='EducationPlan')
router.register(r'group', GroupViewSet, basename='Group')
router.register(r'lecture_hall', LectureHallViewSet, basename='LectureHall')
router.register(r'lesson', LessonViewSet, basename='Lesson')
router.register(r'teacher', TeacherViewSet, basename='Teacher')
router.register(r'training_direction',
                TrainingDirectionViewSet,
                basename='TrainingDirection')
router.register(r'flow', FlowViewSet, basename='Flow')
示例#9
0
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 include, path
from rest_auth.views import LoginView, LogoutView, UserDetailsView
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='API')


urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^login/$',  LoginView.as_view(), name='login'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^detail/$', UserDetailsView.as_view(), name='Detail'),
    path('review/', include('review.urls')),
    path('register/', include('account.urls')),
    path('docs', schema_view),


]
示例#10
0
routes = getattr(settings, 'REACT_ROUTES', [])

urlpatterns = [
    # path('admin/', admin.site.urls),

    #REACT로 만든 index.html 게시글 접근
    # path('', TemplateView.as_view(template_name='index.html'),name='index'),
    #REACT ROUTER 역할 처럼 다시 들어올수 있도록 설정하기
    url(r'^(%s)?$' % '|'.join(routes), TemplateView.as_view(template_name="index.html"),name='index'),

    path('', include('board.urls')),
    path('accounts/', include('accounts.urls')),

    # path('api/token/', obtain_jwt_token),
    # path('api/token/verify/', verify_jwt_token),
    # path('api/token/refresh/', refresh_jwt_token),
    # path('api-auth/', include('rest_framework.urls')),

    #로그인
    # path("rest-auth/", include('rest_auth.urls')),

    path('rest-auth/login', LoginView.as_view(), name='rest_login'),
    path('rest-auth/logout', LogoutView.as_view(), name='rest_logout'),
    path('rest-auth/user', UserDetailsView.as_view(), name='rest_user_details'),
    path('rest-auth/password/change', PasswordChangeView.as_view(), name='rest_password_change'),
    
    #회원가입
    path("rest-auth/registration", include('rest_auth.registration.urls')),
] 

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
示例#11
0
from django.conf.urls import patterns, url

from rest_auth.views import (
    LoginView,
    LogoutView,
    UserDetailsView,
    PasswordChangeView,
    PasswordResetView,
    PasswordResetConfirmView,
)

urlpatterns = patterns(
    "",
    # URLs that do not require a session or valid token
    url(r"^password/reset", PasswordResetView.as_view(), name="rest_password_reset"),
    url(r"^confirm/password/reset", PasswordResetConfirmView.as_view()),
    # url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'),
    url(
        r"^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$",
        PasswordResetConfirmView.as_view(),
        name="password_reset_confirm",
    ),
    url(r"^login", LoginView.as_view(), name="rest_login"),
    # URLs that require a user to be logged in with a valid session / token.
    url(r"^logout", LogoutView.as_view(), name="rest_logout"),
    url(r"^user/$", UserDetailsView.as_view(), name="rest_user_details"),
    url(r"^password/change", PasswordChangeView.as_view(), name="rest_password_change"),
)
示例#12
0
from django.urls import path
from .views import (
    ListCreateBoardsView,
    RetrieveUpdateDeleteBoardsView,
    ListCreateBoardMembersView,
    RetrieveUpdateDeleteBoardMembersView,
)
from rest_auth.views import UserDetailsView
from .models import Board

urlpatterns = [
    path('boards/', ListCreateBoardsView.as_view(), name='boards'),
    path("boards/<uuid:board_id>/",
         RetrieveUpdateDeleteBoardsView.as_view(),
         name='board_details'),
    path("boards/<uuid:board_id>/members/",
         ListCreateBoardMembersView.as_view(),
         name='board_members'),
    path("boards/<uuid:board_id>/members/<uuid:member_id>",
         RetrieveUpdateDeleteBoardMembersView.as_view(),
         name='board_member_details'),
    path("profile/", UserDetailsView.as_view(), name='user_profile'),
]
示例#13
0
from django.urls import path, re_path
from rest_auth.registration.views import VerifyEmailView
from rest_auth.views import LogoutView, UserDetailsView
from rest_framework import routers

from users.views import (AuthPermissionListView, GroupViewSet,
                         StaffRegisterView, UserLoginView, UserRegisterView,
                         UserViewSet)

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'groups', GroupViewSet)

urlpatterns = [
    path('register-user/', UserRegisterView.as_view(), name='user_registration'),
    path('register-staff/', StaffRegisterView.as_view(), name='staff_registration'),
    # login/logout
    path('login/', UserLoginView.as_view(), name='user_login'),
    path('logout/', LogoutView.as_view(), name='user_logout'),
    path('detail/', UserDetailsView.as_view(), name='user_detail'),
    re_path(r'^account-confirm-email/', VerifyEmailView.as_view(),
            name='account_email_verification_sent'),
    re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(),
            name='account_confirm_email'),

    # users permissions list view
    path('permissions/', AuthPermissionListView.as_view())
]

urlpatterns += router.urls
示例#14
0
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.conf import settings
from django.urls import path, re_path, include
from api import urls
from rest_auth.registration.views import VerifyEmailView, RegisterView
from rest_auth.views import UserDetailsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include('api.urls')),
    path('rest-auth/', include('rest_auth.urls')),
    path('combinator/', include('api.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),
    re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$',
            VerifyEmailView.as_view(),
            name='account_confirm_email'),
    re_path(r'^account-confirm-email/$',
            VerifyEmailView.as_view(),
            name='account_email_verification_sent'),
    path('rest-auth/user/', UserDetailsView.as_view(), name='user_detail_view')
]
示例#15
0
from django.contrib import admin
from django.conf.urls import include, url
from rest_auth.views import (LoginView,LogoutView,UserDetailsView,
							PasswordChangeView,PasswordResetView,
							PasswordResetConfirmView
							)

from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView, RedirectView

# urlpatterns = [
#     path('admin/', admin.site.urls),
# ]

urlpatterns = [
    # url(r'^api/', include('rest_auth.urls'))
    url(r'login/',  csrf_exempt(LoginView.as_view()),name='login'),
    url(r'logout/',  LogoutView.as_view(),name='logout'),
    url(r'user/', UserDetailsView.as_view(),name='user_details'),
    url(r'password/change/',PasswordChangeView.as_view(),name='password_change'),
    url(r'password/reset/confirm/',PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
    url(r'password/reset/',PasswordResetView.as_view(),name='password_reset')
    

]

示例#16
0
# Import the module somewhere, so it can register itself.
import qabel_provider.monitoring

rest_auth_register_urls = [
    url(r'^$', views.PasswordPolicyRegisterView.as_view(), name='rest_register'),
    url(r'^verify-email/$', VerifyEmailView.as_view(), name='rest_verify_email'),
]

rest_auth_urls = [
    url(r'^password/reset/$', PasswordResetView.as_view(),
        name='rest_password_reset'),
    url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(),
        name='rest_password_reset_confirm'),
    url(r'^login/$', views.ThrottledLoginView.as_view(), name='rest_login'),
    url(r'^logout/$', LogoutView.as_view(), name='rest_logout'),
    url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'),
    url(r'^password/change/$', PasswordChangeView.as_view(),
        name='rest_password_change'),
]

rest_urls = [
    url(r'^$', views.api_root, name='api-root'),
    url(r'^auth/', include(rest_auth_urls)),
    url(r'^auth/registration/', include(registration_urls)),
    url(r'^internal/user/$', views.auth_resource, name='api-auth'),
    url(r'^internal/user/register/$', views.register_on_behalf),

    url(r'^plan/subscription/$', views.plan_subscription),
    url(r'^plan/add-interval/$', views.plan_add_interval),
]
示例#17
0
from django.urls import path, include
from rest_framework import routers
from . import views
from rest_auth.views import (LogoutView, UserDetailsView, PasswordChangeView,
                             PasswordResetView, PasswordResetConfirmView)

urlpatterns = [
    path('login', views.LoginView.as_view(), name='login-url'),
    path('google_login', views.GoogleLoginView.as_view()),
    path('password/reset', PasswordResetView.as_view()),
    path('password/reset/confirm', PasswordResetConfirmView.as_view()),
    path('logout', LogoutView.as_view()),
    path('user', UserDetailsView.as_view()),
    path('password/change', PasswordChangeView.as_view()),
]
示例#18
0
)

from .api import UserAPI


router = routers.SimpleRouter()
router.register(r"users", UserAPI)

app_name = "users"

rest_auth_overrides = [
    # URLs that do not require a session or valid token
    path("password/reset/", PasswordResetView.as_view(), name="rest_password_reset"),
    path(
        "password/reset/confirm/",
        PasswordResetConfirmView.as_view(),
        name="rest_password_reset_confirm",
    ),
    path("login/", LoginView.as_view(), name="rest_login"),
    # URLs that require a user to be logged in with a valid session / token.
    path("logout/", LogoutView.as_view(), name="rest_logout"),
    path("me/", UserDetailsView.as_view(), name="rest_user_details"),
    path("password/change/", PasswordChangeView.as_view(), name="rest_password_change"),
]

urlpatterns = (
    [path("register/", include("rest_auth.registration.urls"))]
    + rest_auth_overrides
    + router.urls
)
示例#19
0
    path('swagger/', schema_view),
    path('api/', include(router.urls)),

    # URLs that do not require a session or valid token
    path('auth/password/reset/',
         PasswordResetView.as_view(),
         name='password_reset'),
    path('auth/password-reset/confirm/<str:uidb64>/<str:token>/',
         ResCon.as_view(),
         name='password_reset_confirm'),
    path('auth/password-reset/complete/',
         viewsets.password_reset_complete,
         name='password_reset_complete'),

    # URLs that require a user to be logged in with a valid session / token.
    path('auth/user/', UserDetailsView.as_view(), name='user_details'),
    path('auth/password/change/',
         PasswordChangeView.as_view(),
         name='password_change'),

    # same as rest_auth.views, but with
    path('auth/registration/', RegisterView.as_view(), name='register'),
    path('auth/login/', LoginView.as_view(), name='login'),

    # This url is used by django-allauth and empty TemplateView is
    # defined just to allow reverse() call inside app, for example when email
    # with verification link is being sent, then it's required to render email
    # content.

    # account_confirm_email - You should override this view to handle it in
    # your API client somehow and then, send post to /verify-email/ endpoint
示例#20
0
from django.urls import include
from django.urls import path

from api.auth.google import GoogleLogin
from api.company.view import UserCompaniesView
from rest_auth.views import UserDetailsView

urlpatterns = [
    path('auth/google', GoogleLogin.as_view(), name='google_login'),
    path('user', UserDetailsView.as_view(), name='user_details'),
    path('user_companies', UserCompaniesView.as_view(), name='user_companies'),
]
示例#21
0
 url(r'^accounts/slack/connect/callback/$', slack_connect_callback, name="slack-connect-callback"),
 url(r'^accounts/github/connect/callback/$', github_connect_callback, name="github-connect-callback"),
 url(r'^accounts/exact/connect/callback/$', exact_connect_callback, name="exact-connect-callback"),
 url(r'^accounts/', include('allauth.urls')),
 url(r'api/', include(router.urls)),
 url(r'^api/auth/register/account-confirm-email/(?P<key>\w+)/$', ConfirmEmailView.as_view(),
     name='account_confirm_email'),
 url(r'^api/auth/register/', include('rest_auth.registration.urls')),
 url(r'^api/auth/verify/', VerifyUserView.as_view(), name='auth-verify'),
 url(r'^api/auth/visitor/', EmailVisitorView.as_view(), name='auth-visitor'),
 url(r'^api/auth/jwt/token/', obtain_jwt_token),
 url(r'^api/auth/jwt/refresh/', refresh_jwt_token),
 url(r'^api/auth/jwt/verify/', verify_jwt_token),
 url(r'^api/oauth/', include('oauth2_provider.urls', namespace='oauth2_provider')),
 url(r'^api/me/account/', AccountInfoView.as_view(), name='account-info'),
 url(r'^api/me/user/', UserDetailsView.as_view(), name='user-info'),
 url(r'^api/me/profile/', ProfileView.as_view(), name='profile-info'),
 url(r'^api/me/company/', CompanyView.as_view(), name='company-info'),
 url(r'^api/me/settings/', UserSettingsView.as_view(), name='user-settings'),
 url(r'^api/me/notification/', NotificationView.as_view(), name='user-notifications'),
 url(r'^api/me/app/(?P<provider>\w+)/repos/$', RepoListView.as_view(), name="repo-list"),
 url(r'^api/me/app/(?P<provider>\w+)/issues/$', IssueListView.as_view(), name="issue-list"),
 url(r'^api/me/app/slack/$', SlackIntegrationView.as_view(), name="slack-app"),
 url(r'^api/me/app/slack/(?P<resource>\w+)/$', SlackIntegrationView.as_view(), name="slack-app-resource"),
 url(r'^api/hook/coinbase/$', coinbase_notification, name="coinbase-notification"),
 url(r'^api/hook/bitpesa/$', bitpesa_notification, name="bitpesa-notification"),
 url(r'^api/hook/slack/customer/$', slack_customer_notification, name="slack-customer-notification"),
 url(r'^api/hook/hubspot/$', hubspot_notification, name="hubspot-notification"),
 url(r'^api/hook/calendly/$', calendly_notification, name="calendly-notification"),
 url(r'^api/auth/', include('rest_auth.urls')),
 url(r'api/', include('rest_framework.urls', namespace='rest_framework')),
示例#22
0
from rest_framework.authtoken.views import ObtainAuthToken

rest_auth_patterns = (
    # re-written from rest_auth.urls because of cache validation
    # URLs that do not require a session or valid token
    url(r'^password/reset/$',
        cache_page(0)(PasswordResetView.as_view()),
        name='rest_password_reset'),
    url(r'^password/reset/confirm/$',
        cache_page(0)(PasswordResetConfirmView.as_view()),
        name='rest_password_reset_confirm'),
    url(r'^login/$', cache_page(0)(LoginView.as_view()), name='rest_login'),
    # URLs that require a user to be logged in with a valid session / token.
    url(r'^logout/$', cache_page(0)(LogoutView.as_view()), name='rest_logout'),
    url(r'^user/$',
        cache_page(0)(UserDetailsView.as_view()),
        name='rest_user_details'),
    url(r'^password/change/$',
        cache_page(0)(PasswordChangeView.as_view()),
        name='rest_password_change'),
)

apipatterns = (
    url(r'^$',
        login_required(cache_page(60 * 60)(APIRoot.as_view())),
        name='root_listing'),
    # url(r'^explore/', include('rest_framework_swagger.urls',
    #     namespace='swagger')),
    url(r'^common/', include('common.urls', namespace='common')),
    url(r'^users/', include('users.urls', namespace='users')),
    url(r'^facilities/', include('facilities.urls', namespace='facilities')),