def test_get_user_profile_view(self): request = self.factory.get('/') response = UserProfileView.as_view()( request, username=self.user.username) response.render() self.assertEqual(response.status_code, 200) self.assertIn(self.user.username, response.content)
def test_user_details(self): """test for user details url""" url = reverse('users:details', kwargs={'username': '******'}) self.assertEqual( resolve(url).func.__name__, UserProfileView.as_view({ 'get': 'retrieve' }).__name__)
def test_signup(self): """test for signup url""" url = reverse('users:signup') self.assertEqual( resolve(url).func.__name__, UserProfileView.as_view({ 'post': 'create' }).__name__)
from rooms.views import RoomListView, RoomCreateView, RoomCreateWithUserView from rooms.views_api import RoomViewSet from users.views import UserProfileView, UserProfileGenericView from users.views_api import UserViewSet router = DefaultRouter() router.register(r'rooms', RoomViewSet, basename='room') router.register(r'users', UserViewSet, basename='user') urlpatterns = [ path('', RoomListView.as_view(), name='room-list'), path('admin/', admin.site.urls), path('api-auth/', include('rest_framework.urls')), path('api/', include(router.urls)), path('users/<str:username>/', UserProfileView.as_view(), name='user-profile'), path('users/details/<str:username>/', UserProfileGenericView.as_view(), name='user-profile-generic'), path('rooms/', RoomCreateView.as_view(), name='room-create'), path('rooms/create/', RoomCreateWithUserView.as_view(), name='room-create-with-user'), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf.urls import url from users.views import (LoginView, PermissionUpdateView, PermissionVerifyView, IdentifierCheckView, RegisterView, PasswordResetView, PasswordChangeView, UserProfileView) urlpatterns = [ url(r'^/identifier/check$', IdentifierCheckView.as_view(), name='identifier_check'), url(r'^/register$', RegisterView.as_view(), name='register'), url(r'^/login$', LoginView.as_view(), name='login'), url(r'^/permission/update$', PermissionUpdateView.as_view(), name='permission_update'), url(r'^/permission/verify$', PermissionVerifyView.as_view(), name='permission_verify'), url(r'^/password/reset$', PasswordResetView.as_view(), name='password_reset'), url(r'^/password/change$', PasswordChangeView.as_view(), name='password_change'), url(r'^/profile$', UserProfileView.as_view(), name='profile'), ]
from users.views import (UserSignUpView, UserProfileView, ListCreateOrganizationsAPIView, OrganizationProfileGetView, OrganizationUsersAPIView, ListAllUsersAPIView,) from django.urls import path app_name = 'users' urlpatterns = [ path('signup/', UserSignUpView.as_view(), name='signup-api'), path('user/', UserProfileView.as_view(), name='user-retrieve-update-destroy-api'), path('users/all/', ListAllUsersAPIView.as_view(), name='list-all-users-api'), path('organizations/', ListCreateOrganizationsAPIView.as_view(), name='list-create-org'), path('organizations/users/', OrganizationUsersAPIView.as_view(), name='org-users'), path('organization/<int:pk>/detail/', OrganizationProfileGetView.as_view(), name='org-retrieve-api'), ]
from users.views import UserProfileView, UserCreateAPIView from django.urls import path app_name = 'users' urlpatterns = [ path('user/<int:pk>/', UserProfileView.as_view(), name='user-retrieve-update-api'), path('user/create/', UserCreateAPIView.as_view(), name='user-create-callback-url'), ]
from django.conf.urls import include, url,patterns from django.contrib import admin from users.views import RegisterView,LoginView, LogoutView, UserProfileView, GameView from django.views.generic import View from django.views.decorators.csrf import csrf_exempt urlpatterns = patterns('', url(r'^$', GameView.as_view()), url(r'^login/$', csrf_exempt(LoginView.as_view())), url(r'^register/$', csrf_exempt(RegisterView.as_view())), url(r'^logout/$', csrf_exempt(LogoutView.as_view())), url(r'^profile/$', csrf_exempt(UserProfileView.as_view())), # url(r'^search$', SearchView.as_view()), # # url(r'^post$', PostView.as_view()), # # url(r'^repost$', RepostView.as_view()), )
# -*- coding:utf-8 -*- # edit by fuzongfei from django.contrib.auth.decorators import login_required from django.urls import path from users.views import LoginView, UserProfileView, LogoutView, VerifyCodeView, ChangePasswordView, ChangeMobileView, \ ChangePicView, GetEmailCcView, GetAuditorView urlpatterns = [ path('login/', LoginView.as_view(), name='p_login'), path('verify', VerifyCodeView.as_view(), name='p_verifycode'), path('logout/', login_required(LogoutView.as_view()), name='p_logout'), path('profile/', login_required(UserProfileView.as_view()), name='p_profile'), path('change_password/', login_required(ChangePasswordView.as_view()), name='p_change_password'), path('change_mobile/', login_required(ChangeMobileView.as_view()), name='p_change_mobile'), path('change_picture/', login_required(ChangePicView.as_view()), name='p_change_picture'), path('get_email_cc/', login_required(GetEmailCcView.as_view())), path('get_auditor/', login_required(GetAuditorView.as_view())), ]
from django.conf.urls import url from users.views import ( UserProfileView, UserLoginView, UserLogoutView, UserRegisterView ) urlpatterns = [ url( r'^login/$', UserLoginView.as_view(), name='login' ), url( r'^logout/$', UserLogoutView.as_view(), name='logout' ), url( r'^register/$', UserRegisterView.as_view(), name='register' ), url( r'^(?P<username>[\w-]+)/$', UserProfileView.as_view(), name='profile' ), ]
from django.conf.urls import url from users.views import UserView, UserProfileView urlpatterns = [ url(r'^(?P<username>[\w.@+-]+)/$', UserView.as_view(), name='user'), url(r'^(?P<username>[\w.@+-]+)/profile/$', UserProfileView.as_view(), name='user_profile'), ]
urlpatterns = [ url(r'^search$', views.user_search), url(r'^signup/$', UserCreateView.as_view(), name='signup'), url(r'^signup/confirm/(?P<token>\w+)/$', views.user_create_confirm, name='signup_confirm'), url(r'^login/$', views.user_login, name='login'), url(r'^logout/$', views.user_logout, name='logout'), url(r'^reset/$', views.user_request_reset_password, name='request_password_reset'), url(r'^reset/(?P<token>\w+)/$', views.user_reset_password, name='password_reset'), url(r'^update-password/$', views.user_password, name='update-password'), url(r'^(?P<pk>\d+)/$', UserProfileView.as_view(), name='profile'), url(r'^(?P<username>[^/]+)/$', views.user_profile_by_username, name='profile_username'), url(r'^(?P<pk>\d+)/edit/$', UserUpdateView.as_view(), name='edit'), url(r'^(?P<pk>\d+)/delete/$', UserDeleteView.as_view(), name='delete'), url(r'^(?P<pk>\d+)/favorites/$', UserFavoriteView.as_view(), name='favorites'), url(r'^notification/(?P<pk>\d+)/see/$', views.see_nofitication, name='see_notification'), url(r'^notification/mark-all/$', views.mark_all_as_read, name='mark_notifications_as_read'), url(r'^notification/show-all/$',
path( "users/register/complete/", TemplateView.as_view( template_name="django_registration/registration_complete.html"), name="users-registration-complete", ), path( "users/register/closed/", TemplateView.as_view( template_name="django_registration/registration_disallowed.html"), name="users-registration-disallowed", ), path('users/register/', UserRegisterView.as_view(), name='users-register'), path('users/login/', login_view, name='users-login'), path('users/logout/', LogoutView.as_view(), name='users-logout'), path('users/<int:pk>/', UserProfileView.as_view(), name='user-details'), path('users/<int:pk>/edit/', UserProfileEditView.as_view(), name='user-edit'), path('users/edit/user-set-default-picture/', UserSetDefaultPicture.as_view(), name='user-set-default-picture'), path('users/password-change/', UserPasswordChangeView.as_view(), name='user-password-change'), path('users/password-reset/', UserPasswordResetView.as_view(), name='user-password-reset'), path('users/password-reset-confirm/<uidb64>/<token>/', UserPasswordResetConfirmView.as_view(), name='user-password-reset-confirm'),
# Copyright (c) Code Written and Tested by Ahmed Emad in 31/01/2020, 17:29 from django.urls import path, include from rest_framework.routers import DefaultRouter from users.views import UserProfileView, UserAddressView, user_login addresses_router = DefaultRouter() addresses_router.register('', UserAddressView, basename='addresses') app_name = 'users' urlpatterns = [ path('signup', UserProfileView.as_view({'post': 'create'}), name='signup'), path('login/', user_login, name='login'), path('<username>/', UserProfileView.as_view({ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy' }), name='details'), path('<username>/addresses/', include(addresses_router.urls)) ]
from django.urls import path from users.views import ( logout_view, LoginView, SignUpView, UserProfileView, UpdateProfileView, UpdatePasswordView, ) app_name = "users" urlpatterns = [ path("logout/", logout_view, name="logout"), path("login/", LoginView.as_view(), name="login"), path("signup/", SignUpView.as_view(), name="signup"), path("<int:pk>/", UserProfileView.as_view(), name="profile"), path("update-profile/", UpdateProfileView.as_view(), name="update"), path("update-passwod/", UpdatePasswordView.as_view(), name="password"), ]
from django.contrib.auth.views import LogoutView # Views from users.views import (LoginUserView, UserProfileView, update_experencie_languages, UpdateImageProfile, DeleteImageProfile, RegisterUserView, ListUpdateExperencieProfileView, AnalysisToolsProgrammerView, CreateExperencieCompanyView, ExperencieCompanyAPIView, UserAnalysisToolsView) urlpatterns = [ path('login/', LoginUserView.as_view(), name='login'), path('register/', RegisterUserView.as_view(), name='register'), path('logout/', LogoutView.as_view(), name='logout'), path('<str:slug>/profile/', UserProfileView.as_view(), name='profile_user'), path('update/languages/', update_experencie_languages, name='update_languages'), path('profile/<int:pk>/', UpdateImageProfile.as_view(), name='update_image_profile'), path('profile/<int:pk>/delete/', DeleteImageProfile.as_view(), name='delete_image_profile'), path('profiles/<int:pk_profile_user>/total-experencie/', ListUpdateExperencieProfileView.as_view(), name='update_total_experencie'), path('<str:username>/analysis-tools/', AnalysisToolsProgrammerView.as_view(),
from users.views import ClientDatatableView, ClientAdd, ClientUpdate, ClientDelete, ClientView from users.views import UserProfileDatatableView, UserProfileAdd, UserProfileUpdate, UserProfileDelete from users.views import UserProfileUpdatePassword, UserProfileView, CanceledClientAppointments from users.views import ClientAppointmentsView, PendingClientAppointments urlpatterns = [ url(r"^$", login_required(ClientDatatableView.as_view()), name="list"), url(r"^add/$", login_required(ClientAdd.as_view()), name="add"), url(r"^edit/(?P<pk>\d+)/$", login_required(ClientUpdate.as_view()), name="edit"), url(r"^delete/(?P<pk>\d+)/$", login_required(ClientDelete.as_view()), name="delete"), url(r"^client/(?P<pk>\d+)/$", login_required(ClientView.as_view()), name="client"), url( r"^client-appointments/(?P<pk>\d+)/$", login_required(ClientAppointmentsView.as_view()), name="client_appointments", ), url(r"^canceled-clients/$", login_required(CanceledClientAppointments.as_view()), name="clients_canceled"), url(r"^pending-clients/$", login_required(PendingClientAppointments.as_view()), name="clients_pending"), url(r"^staff/$", login_required(UserProfileDatatableView.as_view()), name="staff_list"), url(r"^staff/add/$", login_required(UserProfileAdd.as_view()), name="staff_add"), url(r"^staff/edit/(?P<pk>\d+)/$", login_required(UserProfileUpdate.as_view()), name="staff_edit"), url( r"^staff/edit-password/(?P<pk>\d+)/$", login_required(UserProfileUpdatePassword.as_view()), name="staff_edit_password", ), url(r"^staff/delete/(?P<pk>\d+)/$", login_required(UserProfileDelete.as_view()), name="staff_delete"), url(r"^staff/view/(?P<pk>\d+)/$", login_required(UserProfileView.as_view()), name="staff"), ]
from users.views import UserProfileView from django.conf.urls import url from django.urls import include, path urlpatterns = [ path('', UserProfileView.as_view(), name="user_signup"), ]
# -*- coding:utf-8 -*- # edit by fuzongfei from django.contrib.auth.decorators import login_required from django.urls import path from users.views import LoginView, UserProfileView, LogoutView, ChangePasswordView, ChangeMobileView, ChangePicView, \ GetUserMailView, VerifyView urlpatterns = [ path('login/', LoginView.as_view(), name='p_login'), path('verify', VerifyView.as_view(), name='p_verify'), path(r'logout/', login_required(LogoutView.as_view()), name='p_logout'), path(r'profile/', login_required(UserProfileView.as_view()), name='p_user_profile'), path(r'change_password/', login_required(ChangePasswordView.as_view()), name='p_change_password'), path(r'change_mobile/', login_required(ChangeMobileView.as_view()), name='p_change_mobile'), path(r'change_picture/', login_required(ChangePicView.as_view()), name='p_change_picture'), # 获取用户名和邮箱 path(r'get_usermail/', login_required(GetUserMailView.as_view()), name='p_get_user_mail'), ]
url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name="home"), url(r'^signup/$', SignupView.as_view(), name="signup"), url(r'^login/$', UserLoginView.as_view(), name="login"), url(r'^logout/$', logout_user, name="logout"), url(r'^register/goods/$', SellCreateView.as_view(), name="register_goods"), url(r'^sell/list/$', GoodsListView.as_view(), name="goods_list"), url(r'^sell/(?P<slug>\w+)/modify/$', SellUpdateView.as_view(), name="goods_modify"), url(r'^sell/(?P<slug>\w+)/comment/$', CommentAttachAPIView.as_view(), name="attach_comment"), url(r'^sell/(?P<slug>\w+)/$', GoodsDetailView.as_view(), name="goods_detail"), url(r'^api/sell/(?P<pk>\d+)/comment/$', CommentAPIView.as_view(), name="api_sell_comment"), url(r'^api/sell/(?P<pk>\d+)/$', SellDetailAPIView.as_view(), name="api_sell_detail"), url(r'^api/sell/$', SellListAPIView.as_view(), name="api_sell_list"), url(r'^api/user_check/$', UserCheckAPIView.as_view(), name="user_check"), url(r'^api/email_check/$', UserEmailAPIView.as_view(), name="email_check"), url(r'^api/phone_certificate/$', CertificateUserPhone.as_view(), name="phone_check"), url(r'^api/phone_certificate/check/$', CheckCertificatePhone.as_view(), name="phone_certificate"), url(r'^buy/check/(?P<slug>\w+)/$', OrderCheckView.as_view(), name="buy_check"), url(r'^buy/(?P<slug>\w+)/complete/$', OrderCompleteView.as_view(), name="buy_complete"), url(r'^buy/(?P<slug>\w+)/$', OrderPageView.as_view(), name="buy_page"), url(r'^user/(?P<slug>\w+)/modify/$', UserProfileModifyView.as_view(), name="profile_modify"), url(r'^user/(?P<slug>\w+)/$', UserProfileView.as_view(), name="profile"), url(r'^send_email/$', send_email, name="send_email"), url('', include('social.apps.django_app.urls', namespace='social')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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.static import static from django.contrib import admin from django.contrib.auth.decorators import login_required from django.urls import path, include from opsql import settings from users.views import UserProfileView urlpatterns = [ path('admin/', admin.site.urls), path(r'', login_required(UserProfileView.as_view())), path('users/', include('users.urls')), path('orders/', include('orders.urls')), path('query/', include('query.urls')), path('dash/', include('dash.urls')), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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.contrib import admin from django.urls import path, include from django.views.generic import RedirectView from users.views import register from django.conf import settings from django.conf.urls.static import static from answers.views import edit_rate from users.views import UserProfileView urlpatterns = [ path('admin/', admin.site.urls), path('', RedirectView.as_view(pattern_name='question_list')), path('questions/', include('questions.urls')), path('accounts/', include('django.contrib.auth.urls')), path('user_profile/<int:pk>/', UserProfileView.as_view(), name='user_profile'), path('answer/edit_rate/<int:pk>/', edit_rate, name='edit-rate'), path('accounts/registration', register, name='registration') ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
""" from django.conf.urls import url from users import views from users.views import ( UserCreateView, UserProfileView, UserUpdateView, UserDeleteView, UserFavoriteView, ) urlpatterns = [ url(r'^search$', views.user_search), url(r'^signup/$', UserCreateView.as_view(), name='signup'), url(r'^signup/confirm/(?P<token>\w+)/$', views.user_create_confirm, name='signup_confirm'), url(r'^login/$', views.user_login, name='login'), url(r'^logout/$', views.user_logout, name='logout'), url(r'^reset/$', views.user_request_reset_password, name='request_password_reset'), url(r'^reset/(?P<token>\w+)/$', views.user_reset_password, name='password_reset'), url(r'^update-password/$', views.user_password, name='update-password'), url(r'^(?P<pk>\d+)/$', UserProfileView.as_view(), name='profile'), url(r'^(?P<username>[^/]+)/$', views.user_profile_by_username, name='profile_username'), url(r'^(?P<pk>\d+)/edit/$', UserUpdateView.as_view(), name='edit'), url(r'^(?P<pk>\d+)/delete/$', UserDeleteView.as_view(), name='delete'), url(r'^(?P<pk>\d+)/favorites/$', UserFavoriteView.as_view(), name='favorites'), url(r'^notification/(?P<pk>\d+)/see/$', views.see_nofitication, name='see_notification'), url(r'^notification/mark-all/$', views.mark_all_as_read, name='mark_notifications_as_read'), url(r'^notification/show-all/$', views.show_all_notifications, name='show_all_notifications') ]
from django.urls import path from django.contrib.auth import views as auth_views from users.views import (SignUpView, activate, LoginView, UserProfileView, UserDeleteView, PasswordResetRequestView) from django.conf.urls import url app_name = "user" urlpatterns = [ # User registration and account activation path('sign-up/', SignUpView.as_view(), name='sign-up'), url(r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', activate, name='activate'), # Login and logout path('sign-in/', LoginView.as_view(), name='sign-in'), path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'), # User profile path('profile/', UserProfileView.as_view(), name='profile'), # Delete user path('delete/<int:pk>/user/', UserDeleteView.as_view(), name='user-delete'), # Request a user password reset path('password-reset/', PasswordResetRequestView.as_view(), name='password-reset'), ]