Esempio n. 1
0
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"),

)
Esempio n. 2
0
from django.conf.urls import patterns, url
from django.views.generic import TemplateView

from views import FriendsView

urlpatterns = patterns(
    '',
    url(r'^$', FriendsView.as_view(template_name='friends/index.html')),
)