2016-09-05 13:38:21 +00:00
|
|
|
from django.conf.urls import url
|
2016-08-31 12:39:25 +00:00
|
|
|
from django.contrib.auth import views as auth_views
|
2016-09-05 13:38:21 +00:00
|
|
|
from django.utils.translation import ugettext as _
|
2016-08-14 09:21:04 +00:00
|
|
|
|
2016-08-31 12:39:25 +00:00
|
|
|
import views
|
2016-08-25 05:28:02 +00:00
|
|
|
import api
|
2016-09-06 07:09:00 +00:00
|
|
|
from .forms import UserLoginForm
|
2016-08-09 06:42:21 +00:00
|
|
|
|
|
|
|
app_name = 'users'
|
|
|
|
|
|
|
|
urlpatterns = [
|
2016-09-05 13:38:21 +00:00
|
|
|
url(r'^login$',
|
|
|
|
auth_views.login,
|
|
|
|
{'template_name': "users/login.html",
|
|
|
|
'authentication_form': UserLoginForm,
|
|
|
|
'redirect_authenticated_user': True},
|
|
|
|
name='login'),
|
|
|
|
url(r'^logout$',
|
|
|
|
auth_views.logout,
|
|
|
|
{
|
|
|
|
"template_name": "common/flash_message_standalone.html",
|
|
|
|
"extra_context": {
|
|
|
|
'title': _('Logout success'),
|
|
|
|
'messages': _('Logout success, return login page'),
|
|
|
|
'redirect_url': '/users/login',
|
|
|
|
'auto_redirect': True,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
name='logout'),
|
2016-09-06 07:09:00 +00:00
|
|
|
url(r'^password/forgot$', views.UserForgotPasswordView.as_view(), name='forgot-password'),
|
|
|
|
url(r'^password/forgot/sendmail-success$',
|
|
|
|
views.UserForgotPasswordSendmailSuccessView.as_view(), name='forgot-password-sendmail-success'),
|
2016-09-01 15:09:58 +00:00
|
|
|
url(r'^password/reset$', views.UserResetPasswordView.as_view(), name='reset-password'),
|
2016-09-05 13:38:21 +00:00
|
|
|
url(r'^password/reset/success$', views.UserResetPasswordSuccessView.as_view(),
|
|
|
|
name='reset-password-success'),
|
2016-09-04 08:05:58 +00:00
|
|
|
url(r'^user$', views.UserListView.as_view(), name='user-list'),
|
|
|
|
url(r'^user/(?P<pk>[0-9]+)$', views.UserDetailView.as_view(), name='user-detail'),
|
2016-09-06 06:38:19 +00:00
|
|
|
url(r'^user/create$', views.UserCreateView.as_view(), name='user-create'),
|
|
|
|
url(r'^user/(?P<pk>[0-9]+)/update$', views.UserUpdateView.as_view(), name='user-update'),
|
2016-09-04 08:05:58 +00:00
|
|
|
url(r'^user/(?P<pk>[0-9]+)/delete$', views.UserDeleteView.as_view(), name='user-delete'),
|
2016-09-06 06:38:19 +00:00
|
|
|
url(r'^user-group$', views.UserGroupListView.as_view(), name='user-group-list'),
|
|
|
|
url(r'^user-group/(?P<pk>[0-9]+)$', views.UserGroupDetailView.as_view(), name='user-group-detail'),
|
|
|
|
url(r'^user-group/create$', views.UserGroupCreateView.as_view(), name='user-group-create'),
|
|
|
|
url(r'^user-group/(?P<pk>[0-9]+)/update$', views.UserGroupUpdateView.as_view(), name='user-group-update'),
|
|
|
|
url(r'^user-group/(?P<pk>[0-9]+)/delete$', views.UserGroupDeleteView.as_view(), name='user-group-delete'),
|
2016-08-09 06:42:21 +00:00
|
|
|
]
|
2016-08-25 05:28:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
urlpatterns += [
|
2016-08-29 16:10:27 +00:00
|
|
|
url(r'^v1/users$', api.UserListAddApi.as_view(), name='user-list-api'),
|
2016-09-05 13:38:21 +00:00
|
|
|
url(r'^v1/users/(?P<pk>[0-9]+)$',
|
|
|
|
api.UserDetailDeleteUpdateApi.as_view(), name='user-detail-api'),
|
2016-08-29 16:10:27 +00:00
|
|
|
url(r'^v1/users/(?P<pk>[0-9]+)/active$', api.UserActiveApi.as_view(), name='user-active-api'),
|
2016-09-06 07:09:00 +00:00
|
|
|
url(r'^v1/user-groups$', api.UserGroupListAddApi.as_view(), name='user-group-list-api'),
|
|
|
|
url(r'^v1/user-groups/(?P<pk>[0-9]+)$',
|
|
|
|
api.UserGroupDetailDeleteUpdateApi.as_view(), name='user-group-detail-api'),
|
2016-08-25 05:28:02 +00:00
|
|
|
]
|