示例#1
0
文件: urls.py 项目: mateifl/djsocial
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from djsocial_core.views import signin, HandleFriendRequestView, \
    DeleteFriendRequestView
from views import FriendRequestsView, FriendsView, UserProfileView, \
    UserSearchView, AddFriendView, EditProfileView
from django.views.generic.base import TemplateView


urlpatterns = patterns('',
    url(r'^view-profile/(?P<slug>\w+)$',        login_required(UserProfileView.as_view()), name="view-profile"),
    url(r'^edit-profile/(?P<username>\w+)$',    login_required(EditProfileView.as_view()), name="edit-profile"),
    # user search
    url(r'^search-user/$',                      login_required(UserSearchView.as_view()), name="search-user"),
    url(r'^sr-users/(?P<term>\w+)$',   	        login_required(UserSearchView.as_view()), name="sr-users"),
    # friends and friend requests management
    url(r'^add-friend/(?P<username>\w+)$',      login_required(AddFriendView.as_view()), name="add-friend"),
    url(r'^handle-fr/(?P<username>\w+)/(?P<operation>\w+)$', login_required(HandleFriendRequestView.as_view()),
        name="handle-friend-request"),
    url(r'^friends/', 				            login_required(FriendsView.as_view()), name="friends"),
    url(r'^friend-requests/', 		            login_required(FriendRequestsView.as_view()), name="friend-requests" ),
    url(r'^cancel-request/(?P<id>\d+)$',        login_required(DeleteFriendRequestView.as_view()),
        name="cancel-friend-request"),
    # login management
    url(r'^login/$',                            signin, name="login"),
    url(r'^login-failed/$',                     TemplateView.as_view(template_name='login-failed.html'),
        name="login-failed"),

)
示例#2
0
# -*- coding: utf8 -*-
from django.conf.urls import url, include
from views import UserProfileView

urlpatterns = [
    url(r'^$', UserProfileView.as_view()),
    url(r'^profile/$', UserProfileView.as_view(), name='profile'),
    url(r'^settings/', include('app.user.configs.urls', namespace='settings')),
]
示例#3
0
    PostEditView,
    PostDeleteView,
    UserProfileView,
    UserProfileUpdateView,
    UserProfileCreateView,
    LoginView,
    RegisterView,
    LogoutView,
    UploadImage,
    
)

urlpatterns = [
    url(r'^$', index, name='index'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^$', PostListView.as_view(), name='post_list'),
    url(r'^post/(?P<pk>[0-9]+)/create$', PostCreateView.as_view(), name='post_create'),
    url(r'^post/(?P<pk>[0-9]+)/edit$', PostEditView.as_view(), name='post_edit'),
    url(r'^post/(?P<pk>[0-9]+)$', post_detail, name='post_detail'),
    url(r'^post/(?P<pk>[0-9]+)/delete$', PostDeleteView.as_view(), name='post_delete'),
    url(r'^post/(?P<pk>[0-9]+)/comment/create$', CommentCreateView.as_view(), name='comment_create'),
    url(r'^userprofile/(?P<pk>[0-9]+)$', UserProfileView.as_view(), name='user_profile'),
    url(r'^userprofile/(?P<pk>[0-9]+)/edit$', UserProfileUpdateView.as_view(),name='profile_edit'),
     url(r'^userprofile/(?P<pk>[0-9]+)/create$', UserProfileCreateView.as_view(),
        name='user_profile_create'),
    url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/edit$', CommentEditView.as_view(), name='comment_edit'),
    url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/delete$', CommentDeleteView.as_view(), name='comment_delete'),
    url(r'^post/(?P<pk>[0-9]+)/image/create$', UploadImage.as_view(), name='upload_image'),
] + static(settings.STATIC_URL, document_root = settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) 
示例#4
0
文件: urls.py 项目: krnr/testblog
from django.conf.urls import patterns, include, url
from django.contrib.auth import views

from views import (RegistrationView, RegistrationAfterView, RegistrationConfirmView,
    UserListView, UserProfileView, UserUpdateView,
    LoginView, LogoutView) 

urlpatterns = patterns('accounts.views',
    url(r'^register/$', RegistrationView.as_view(), name='user_register'),
    url(r'^register/confirm/(?P<activation_key>\w+)/', RegistrationConfirmView.as_view(), 
        name='registration_confirm'),
    url(r'^register/thankyou$', RegistrationAfterView.as_view(), name='registration_after'),
    url(r'^login/$', LoginView.as_view(), name='user_login'),
    url(r'^logout/$', LogoutView.as_view(), name='user_logout'),
    url(r'^profile/(?P<pk>\d+)$', UserProfileView.as_view(), name='userprofile'),
    url(r'^profile/$', UserListView.as_view(), name='users'),
    url(r'^update/(?P<pk>\d+)$', UserUpdateView.as_view(), name='update'),
)
示例#5
0
from django.conf.urls import include, url
from views import UserProfileView

urlpatterns = [
    # login/logout urls need to come first
    url(r'^login/$', 'django.contrib.auth.views.login', name='login',
        kwargs={'template_name': 'login.html'}
    ),
    url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout',
        kwargs={'next_page': '/'}
    ),

    url(r'^', UserProfileView.as_view(), name='user_profile'),
]
示例#6
0
    db.create_all()


application.add_url_rule(
    rule='/registration/',
    view_func=UserRegistrationView.as_view('registration'),
)

application.add_url_rule(
    rule='/login/',
    view_func=UserLoginView.as_view('login'),
)

application.add_url_rule(
    rule='/upload_photo/',
    view_func=UploadPhotoView.as_view('upload-photo'),
)

application.add_url_rule(
    rule='/uploads/<file_name>/',
    view_func=ViewFile.as_view('view-file'),
)

application.add_url_rule(
    rule='/user/<user_id>/',
    view_func=UserProfileView.as_view('user-profile'),
)

application.run()
示例#7
0
 # url(r'^post/(?P<pk>[0-9]+)/delete$', post_delete, name='post_delete'),
 url(r'^post/(?P<pk>[0-9]+)/delete$',
     PostDeleteView.as_view(),
     name='post_delete'),
 # url(r'^post/(?P<pk>[0-9]+)/comment/create$', comment_create, name='comment_create'),
 url(r'^post/(?P<pk>[0-9]+)/comment/create$',
     CommentCreateView.as_view(),
     name='comment_create'),
 url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/edit$',
     CommentEditView.as_view(),
     name='comment_edit'),
 url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/delete$',
     CommentDeleteView.as_view(),
     name='comment_delete'),
 url(r'^userprofile/(?P<pk>[0-9]+)$',
     UserProfileView.as_view(),
     name='user_profile'),
 url(r'^userprofile/(?P<pk>[0-9]+)/relations$',
     UserProfileRelationsView.as_view(),
     name='user_profile_relations'),
 url(r'^userprofile/(?P<pk>[0-9]+)/edit$',
     UserProfileUpdateView.as_view(),
     name='profile_edit'),
 # url(r'^accept_friend_request/(?P<user_pk>[0-9]+)$', accept_friend_request,
 #     name='accept_friend_request'),
 url(r'^accept_friend_request/(?P<user_pk>[0-9]+)$',
     AcceptFriendRequestView.as_view(),
     name='accept_friend_request'),
 url(r'^reject_friend_request/(?P<user_pk>[0-9]+)$',
     reject_friend_request,
     name='reject_friend_request'),