from django.conf.urls import url from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from apps.users.views import UserInfoView, UploadImageView, ChangePwdView, ChangeMobileView from apps.users.views import MyFavOrgView, MyFavTeacherView, MyFavCourseView, MyMessageView urlpatterns = [ url(r'^info/$', UserInfoView.as_view(), name="info"), url(r'^image/upload/$', UploadImageView.as_view(), name="image"), url(r'^update/pwd/$', ChangePwdView.as_view(), name="update_pwd"), url(r'^update/mobile/$', ChangeMobileView.as_view(), name="update_mobile"), #url(r'^mycourse/$', MyCourseView.as_view(), name="mycourse"), url(r'^mycourse/$', login_required( TemplateView.as_view(template_name="usercenter-mycourse.html"), login_url="/login/"), {"current_page": "mycourse"}, name="mycourse"), url(r'^myfavorg/$', MyFavOrgView.as_view(), name="myfavorg"), url(r'^myfav_teacher/$', MyFavTeacherView.as_view(), name="myfav_teachers"), url(r'^myfav_course/$', MyFavCourseView.as_view(), name="myfav_course"), url(r'^messages/$', MyMessageView.as_view(), name="messages"), ]
from django.conf.urls import url from apps.users.views import UserInfoView, UploadImageView, ChangePwdView, ChangeMobileView, MycourseView, MyFavView,MyFavTeacherView,MyFavCourseView from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required urlpatterns = [ url(r'^info/$', UserInfoView.as_view(), name='info'), url(r'^image/upolad/$', UploadImageView.as_view(), name='image'), url(r'^update/pwd/$', ChangePwdView.as_view(), name='update_pwd'), url(r'^update/mobile/$', ChangeMobileView.as_view(), name='update_mobile'), # url(r'^mycourse/$', MycourseView.as_view(), name='my_course'), url(r'^mycourse/$', login_required(TemplateView.as_view(template_name="usercenter-mycourse.html"), login_url="/login"), {"current_page": "mycourse"}, name='my_course'), url(r'^mafavorg/$', MyFavView.as_view(), name='my_fav_org'), url(r'^mafavteacher/$', MyFavTeacherView.as_view(), name='my_fav_teacher'), url(r'^mafavcourse/$', MyFavCourseView.as_view(), name='my_fav_course'), ]
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 url from apps.users.views import UserInfoView, CheckCodeView, LoginView, LoginOutView, RegisterView, UserRelationView, \ UserSlaveView, UserSlaveDelView, UserSlaveEditView, AppLogin1View, AppLogin2View, UserFornumView, PasswordView urlpatterns = [ url(r'^login$', LoginView.as_view()), url(r'^checkcode$', CheckCodeView.as_view()), url(r'^loginout$', LoginOutView.as_view()), url(r'^register$', RegisterView.as_view()), url(r'^relations$', UserRelationView.as_view()), url(r'^slaves$', UserSlaveView.as_view()), url(r'^slaves/remove$', UserSlaveDelView.as_view()), url(r'^edit', UserSlaveEditView.as_view()), url(r'^app/login$', AppLogin1View.as_view()), url(r'^app/login2$', AppLogin2View.as_view()), url(r'^pwd$', PasswordView.as_view()), url(r'^user_fornum', UserFornumView.as_view()), url(r'^$', UserInfoView.as_view()) ]
# 全局配置 url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}), path('admin/', admin.site.urls), path(API_ROOT + "ping/", PingView.as_view(), name="ping"), path(API_ROOT + "user/login/", csrf_exempt(UserLoginView.as_view()), name="user_login"), path(API_ROOT + "user/register/", csrf_exempt(UserRegisterView.as_view()), name="user_register"), path(API_ROOT + "user/doki/", csrf_exempt(TokenDokiView.as_view()), name="user_doki"), path(API_ROOT + "user/info/", csrf_exempt(UserInfoView.as_view()), name="user_info"), path(API_ROOT + "user/password/", csrf_exempt(PasswordView.as_view()), name="user_password"), path(API_ROOT + "user/portrait/", csrf_exempt(PortraitView.as_view()), name="user_portrait"), path(API_ROOT + "captcha/", csrf_exempt(CaptchaView.as_view()), name="captcha"), path(API_ROOT + "face/group/", csrf_exempt(FaceGroupView.as_view()), name="face_group"), path(API_ROOT + "face/", csrf_exempt(FaceView.as_view()),
from apps.users.views import UserInfoView, UserCourseView, UserImgUploadView, FavCourseView, FavOrgView, FavTeacherView, UserMsgView, UserChangePwdView from django.conf.urls import url urlpatterns = [ url('^detail/$', UserInfoView.as_view(), name='detail'), url('^mycourse/$', UserCourseView.as_view(), name='mycourse'), url('^favcourse/$', FavCourseView.as_view(), name='favcourse'), url('^favteacher/$', FavTeacherView.as_view(), name='favteacher'), url('^favorg/$', FavOrgView.as_view(), name='favorg'), url('^msg/$', UserMsgView.as_view(), name='msg'), # url(r'^mycourse/$',login_required(TemplateView.as_view(template_name='usercenter-mycourse.html'), login_url='/login/'),{"current_page": "mycourse"}, name='mycourse'), url('^upload/$', UserImgUploadView.as_view(), name='upload'), url('^update/pwd/$', UserChangePwdView.as_view(), name='update_pwd'), ]
from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from apps.users.views import LoginView, LogoutView, SendSmsView, MobileLoginView, RegisterView, UserInfoView, \ UploadImageView, UploadInfoView, UpdatePwdView from apps.users.views import UpdateMobileView, MyFavOrgView, MyFavTeacherView, MyFavCourseView, UsersMessageView urlpatterns = [ path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('send_sms/', SendSmsView.as_view(), name='dend_sms'), path('mobilelogin', MobileLoginView.as_view(), name='mobilelogin'), path('register/', RegisterView.as_view(), name='register'), # 个人中心 url(r'^user_info$', UserInfoView.as_view(), name='user_info'), # 个人中心-个人资料 url(r'^upload_image$', UploadImageView.as_view(), name='upload_image'), # 个人中心-个人资料-修改头像 url(r'^upload_info$', UploadInfoView.as_view(), name='upload_info'), # 个人中心-个人资料修改 url(r'^update_pwd$', UpdatePwdView.as_view(), name='update_pwd'), # 个人中心-个人资料密码修改 url(r'^update_mobile$', UpdateMobileView.as_view(), name='update_mobile'), # 个人中心-个人资料手机号修改 # 我的课程 url(r'^mycourse$', login_required( TemplateView.as_view(template_name='usercenter-mycourse.html')), kwargs={'active': 'mycourse'}, name='mycourse'),
from django.conf.urls import url from apps.users.views import RegisterView, ActiveView, LoginView, UserInfoView, UserOrderView urlpatterns = [ url(r'^register$', RegisterView.as_view(), name='register'), # 注册 url(r'^login$', LoginView.as_view(), name='login'), # 登录 url(r'^active/(?P<token>.*)$', ActiveView.as_view(), name='active'), # 用户激活 url(r'^$', UserInfoView.as_view(), name='user'), # 用户中心-信息页 url(r'^order/(?P<page>\d+)$', UserOrderView.as_view(), name='order'), # 用户中心-订单页 ]
from django.conf.urls import url from apps.users.views import UserInfoView, ChangeMobileView urlpatterns = [ url(r'^info/$', UserInfoView.as_view(), name="list"), url(r'^image/upload/$', UserInfoView.as_view(), name="image"), url(r'^update/mobile/$', ChangeMobileView.as_view(), name="update_mobile"), ]
from apps.users.views import AddressesListView, UserHistoryView urlpatterns = [ # path('usernames/<username>/count/',UsernameCountView.as_view()), path('usernames/<uc:username>/count/', UsernameCountView.as_view()), #########注册url#################### path('register/', RegisterView.as_view()), ###########登录#################### path('login/', LoginView.as_view()), #########退出登录######## path('logout/', LogoutView.as_view()), #########个人中心######## path('info/', UserInfoView.as_view()), #########邮件保存######## path('emails/', EmailView.as_view()), #########激活邮件######## path('emails/verification/', VerifyEmailView.as_view()), #########地址管理######## path('addresses/create/', CreateAddressView.as_view()), #########地址查询######## path('addresses/', AddressesListView.as_view()), #########用户浏览记录######## path('browse_histories/', UserHistoryView.as_view()), ]
from django.conf.urls import url from django.urls import path,re_path from apps.users.views import UserInfoView,UploadImageView,ChangePwdView,MyCourseView,FavOrgView,\ FavTeacherView,FavCourseView,MyMessageView urlpatterns=[ re_path("^info/$",UserInfoView.as_view(),name="info"), re_path("^image/upload/$",UploadImageView.as_view(),name="upload"), re_path("^update/pwd/$",ChangePwdView.as_view(),name="update_pwd"), re_path("^my_course/$",MyCourseView.as_view(),name="mycourse"), re_path("^fav_org/$",FavOrgView.as_view(),name="fav_org"), re_path("^fav_teacher/$",FavTeacherView.as_view(),name="fav_teacher"), re_path("^fav_course/$",FavCourseView.as_view(),name="fav_course"), re_path("^my_messages/$",MyMessageView.as_view(),name="my_message"), ]
from django.urls import path from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from apps.users.views import UserInfoView,UploadImageView,ChangePwdView,ChangeMobileView,MyCourseView,MyFavOrgView,MyFavTeaView,MyFavCourseView,MyMessageView app_name='users' urlpatterns=[ path('info/',UserInfoView.as_view(),name='info'), path('image/upload/',UploadImageView.as_view(),name='image'), path('update/pwd/',ChangePwdView.as_view(),name='update'), path('update/mobile/',ChangeMobileView.as_view(),name='update_mobile'), #path('mycourse/',MyCourseView.as_view(),name='mycourse')#只有get方法,写 一个视图函数,或者直接使用下面的方式 path('mycourse/',login_required(TemplateView.as_view(template_name="usercenter-mycourse.html"),login_url="/login/"),{"current_page":"mycourse"},name='mycourse'), path('myfavorg/',MyFavOrgView.as_view(),name='myfavorg'), path('myfavtea/',MyFavTeaView.as_view(),name='myfavtea'), path('myfavcour/',MyFavCourseView.as_view(),name='myfavcour'), path('messages/',MyMessageView.as_view(),name='messages'), ]
from django.urls import path from apps.users.views import (user_redirect_view, user_update_view, user_detail_view, UserInfoView) app_name = "users" urlpatterns = [ path("~redirect/", view=user_redirect_view, name="redirect"), path("~update/", view=user_update_view, name="update"), path("<str:username>/", view=user_detail_view, name="detail"), # Retrieve user detail with permissions from users id/pk path('user/<int:pk>', UserInfoView.as_view(), name="user_permission"), ]