from django.urls import path, include from rest_framework import routers from rest_framework.authtoken.views import obtain_auth_token from api.views import LogoutView, QuoteViewSet router = routers.DefaultRouter() router.register(r'quotes', QuoteViewSet, basename='quotes') app_name = 'api' urlpatterns = [ path('', include(router.urls)), path('login/', obtain_auth_token, name='index'), path('logout/', LogoutView.as_view(), name='logout'), ]
from django.contrib import admin from django.urls import path,include from rest_framework.urlpatterns import format_suffix_patterns from rest_framework.authtoken.views import ObtainAuthToken from api.views import ( CoursesView, UserMyView, UserView, CourseUserView, LoginView, LogoutView, MessageView, ) from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path('rest-auth/login/',ObtainAuthToken.as_view()), path('auth/login/',csrf_exempt(LoginView.as_view())), path('auth/logout/<str:token>/',csrf_exempt(LogoutView.as_view())), path('courses/<str:token>/',csrf_exempt(CoursesView.as_view())), path('usermy/<str:token>/',csrf_exempt(UserMyView.as_view())), path('user/<str:token>/',csrf_exempt(UserView.as_view())), path('user/<int:pk>/<str:username>/<str:token>/',csrf_exempt(CourseUserView.as_view())), path('messages/<int:pk>/<str:token>/',csrf_exempt(MessageView.as_view())), ] urlpatterns = format_suffix_patterns(urlpatterns)
re_path(r'^user/fb/login/$', FacebookLogin.as_view(), name='fb_login'), re_path(r'^user/google/login/$', GoogleLogin.as_view(), name='google_login'), re_path(r'^accounts/', include('allauth.urls')), ] # Social login links urlpatterns += [ # re_path(r'^user/google/login/$', GoogleLoginApiView.as_view(), name='google_login'), re_path(r'^user/google/login/v2/', GoogleConfirm.as_view(), name='google_login2'), # re_path(r'^user/fb/login/$', FacebookLoginApiView.as_view(), name='facebook_login'), # re_path(r'^user/fb/login/v2', FacebookCheck.as_view(), name='facebook_login2'), re_path(r'^user/fb/login/v2/', FacebookConfirm.as_view(), name='facebook_login2'), # re_path(r'^user/login/$', LoginView.as_view(), name='login'), # re_path(r'^user/logout/$', LogoutView.as_view(), name='logout'), re_path(r'^user/login/$', LoginView.as_view(), name='login'), re_path(r'^user/logout/$', LogoutView.as_view(), name='logout'), re_path(r'^user/registration/', include('rest_auth.registration.urls')), re_path(r'^user/user-list/$', UserListApiView.as_view(), name='user_list'), re_path(r'^user/device/$', UserDevicesApiView.as_view(), name='user_device'), re_path(r'^user/$', UserInfo.as_view(), name='user'), ] # API views to get or update Database from Google elements (calendars/events/contacts/accesses) urlpatterns += [ re_path(r'^user/calendars/synchronize', CalendarSyncApiView.as_view()), # get goole calendars re_path(r'^user/calendars/list', CalendarListApiView.as_view()), # get google calendars from db # re_path(r'^user/calendars/new', CalendarAddView.as_view()), # not needd - add new in re_path(r'^user/calendar$', CalendarAddApiView.as_view()), # get google calendars - for compatibility with app # re_path(r'^user/calendar/(?P<calendar_id>.+)$', CalendarDetailApiView.as_view()), re_path(r'^user/calendar/(?P<calendar_id>.+)/active$', CalendarActiveView.as_view()), # re_path(r'^user/autorize$', CalendarAuthorize.as_view()), # for test google authorize only
from django.conf.urls import patterns, include, url from api.views import LogoutView urlpatterns = patterns( '', # Examples: # url(r'^$', 'pawtrolserver.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^login/', 'rest_framework.authtoken.views.obtain_auth_token'), url(r'^logout/', LogoutView.as_view()), )
from django.urls import path, include from rest_framework import routers from rest_framework.authtoken.views import obtain_auth_token from api.views import ProjectViewSet, IssueViewSet, LogoutView router = routers.DefaultRouter() router.register(r'projects', ProjectViewSet) router.register(r'issues', IssueViewSet) app_name = 'api' urlpatterns = [ path('', include(router.urls)), path('login/', obtain_auth_token, name='obtain_auth_token'), path('logout/', LogoutView.as_view(), name='delete_auth_token'), ]
from django.conf.urls import url from api.views import (LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView) urlpatterns = [ # URLs that do not require a session or valid token 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', 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'), ]
from django.urls import path, include from rest_framework import routers from rest_framework.authtoken.views import obtain_auth_token from api import views from api.views import update, CarListView, CarDetailView, LogoutView, ClientsInAnnounceView router = routers.DefaultRouter() router.register(r'announcements', views.AnnouncementViewSet) router.register(r'users', views.UserViewSet) app_name = 'api/v1' urlpatterns = [ path('', include(router.urls)), path('users/<int:pk>/change_password/', update, name='password_change'), path('cars/', CarListView.as_view(), name='car_list'), path('cars/<int:pk>/', CarDetailView.as_view(), name='car_detail'), path('login/', obtain_auth_token, name='api_token_auth'), path('logout/', LogoutView.as_view(), name='api_token_delete'), path('clients/', ClientsInAnnounceView.as_view(), name='client_create'), # path('new_posts/', SendNewPostsView.as_view(), name='post_send') ]
https://docs.djangoproject.com/en/2.2/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.contrib import admin from django.urls import path from django.conf.urls import include from django.conf import settings from django.conf.urls.static import static from api.views import LoginView, LogoutView urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include('api.urls')), path('api-auth/', include('rest_framework.urls'), name="auth"), path('api/v1/auth/login/', LoginView.as_view(), name="login"), path('api/v1/auth/logout/', LogoutView.as_view()), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
""" URL patterns for farmhands API """ from django.conf.urls import url from api.views import PlanView, PlanDetailView, UserPlanView,\ UserPlanDetailView, LoginView, RegisterView, LogoutView urlpatterns = [ url(r'^plans$', PlanView.as_view(), name='plans'), url(r'^plans/(?P<planid>[0-9]+)$', PlanDetailView.as_view(), name='plan'), url(r'^users/(?P<userid>[0-9]+)/plans$', UserPlanView.as_view(), name='userplans'), url(r'^users/(?P<userid>[0-9]+)/plans/(?P<planid>[0-9]+)$', UserPlanDetailView.as_view(), name='userplan'), url(r'^login$', LoginView.as_view(), name='login'), url(r'^logout$', LogoutView.as_view(), name='logout'), url(r'^register$', RegisterView.as_view(), name='register') ]
WorkExperienceAPIView, WorkExperienceUpdateAPIView, IntrestAPIView, PosterAPIView, SkillsAPIView, CertificationAPIView, PublicationAPIView, ArticleAPIView, PatentAPIView, BookAPIView, ConferenceAPIView, AchievementAPIView, ExtraCurricularAPIView, SocialMediaLinksAPIView, CertificationUpdateAPIView, PublicationUpdateAPIView, PatentUpdateAPIView, ArticleUpdateAPIView, BookUpdateAPIView, PosterUpdateAPIView, ConferenceUpdateAPIView, ExtraCurricularUpdateAPIView, AchievemntUpdateAPIView, SocialMediaLinksUpdateAPIView) from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api/accounts/', UserViewSet.as_view(), name='register'), url(r'^accounts/login', LoginView.as_view(), name='login'), url(r'^accounts/logout', LogoutView.as_view(), name='logout'), url(r'^password_reset', PasswordResetView.as_view(), name='password_reset'), url(r'^create/$', UserInfoAPIView.as_view(), name='user_info'), url(r'^(?P<username>[\w.@+-]+)/create/$', UserUpdateViewSet.as_view(), name='user_info_edit'), #update url(r'^education/', EducationalAPIView.as_view(), name='education_info'), url(r'^(?P<username>[\w.@+-]+)/education/$', EducationalUpdateAPIView.as_view(), name='education_info_update'),#update url(r'^work/$', WorkExperienceAPIView.as_view(), name='work'), url(r'^(?P<username>[\w.@+-]+)/work/', WorkExperienceUpdateAPIView.as_view(), name='work_update'), url(r'^intrest/', IntrestAPIView.as_view(), name='intrest'), url(r'^(?P<username>[\w.@+-]+)/intrest/', IntrestUpdateAPIView.as_view(), name='intrest_update'), url(r'^skills/', SkillsAPIView.as_view(), name='skills'), url(r'^(?P<username>[\w.@+-]+)/skills/', SkillsUpdateAPIView.as_view(), name='skills_update'), url(r'^certification/', CertificationAPIView.as_view(), name='certification'), url(r'^(?P<username>[\w.@+-]+)/certification/', CertificationUpdateAPIView.as_view(), name='certification_update'), url(r'^(?P<username>[\w.@+-]+)/publication/', PublicationUpdateAPIView.as_view(), name='publication_update'), url(r'^publication/', PublicationAPIView.as_view(), name='publication'),