Merge tag '0.10.2'
[ganeti_webmgr.git] / muddle_users / urls.py
blobd4e231138de4aec468e1971b4e7bab1c2f989b4f
1 # Copyright (C) 2010 Oregon State University et al.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 # USA.
18 from django.conf import settings
19 from django.conf.urls.defaults import patterns, url
21 # If muddled.shots is installed then load templates that allow mixers to extend
22 # the templates. Otherwise use standard templates. The standard templates can
23 # still be overridden by manually adding a url with a different template
24 # attribute
25 if 'muddle.shots' in settings.INSTALLED_APPS:
26 USER_TEMPLATE = 'muddle/user/detail.html'
27 GROUP_TEMPLATE = 'muddle/group/detail.html'
28 GROUP_LIST_TEMPLATE = 'muddle/group/list.html'
29 USER_ROW_TEMPLATE = 'muddle/group/user_row.html'
30 else:
31 USER_TEMPLATE = 'user/detail.html'
32 GROUP_TEMPLATE = 'group/detail.html'
33 GROUP_LIST_TEMPLATE = 'group/list.html'
34 USER_ROW_TEMPLATE = 'group/user_row.html'
37 # Users
38 urlpatterns = patterns('muddle_users.views.user',
39 url(r'^accounts/profile/?', 'user_profile', name="profile"),
40 url(r'^users/?$', 'user_list', name="user-list"),
41 url(r'^user/add/?$', 'user_add', name="user-create"),
42 url(r'^user/(?P<user_id>\d+)/?$', 'user_detail', {'template':USER_TEMPLATE}, name="user-detail"),
43 url(r'^users/(?P<username>[\w@.+-]+)/?$', 'user_detail', {'template':USER_TEMPLATE}, name="user-detail-name"),
44 url(r'^user/(?P<user_id>\d+)/edit/?$', 'user_edit', name="user-edit"),
45 url(r'^user/(?P<user_id>\d+)/password/?$', 'user_password', name="user-password"),
48 # Groups
49 urlpatterns += patterns('muddle_users.views.group',
50 # Groups
51 url(r'^groups/$', 'list', {'template': GROUP_LIST_TEMPLATE}, name="group-list"),
52 url(r'^group/add/?$', 'edit', name="group-add"),
53 url(r'^group/(?P<id>\d+)/?$', 'detail', {'template':GROUP_TEMPLATE}, name="group-detail"),
54 url(r'^group/(?P<id>\d+)/edit/?$', 'edit', name="group-edit"),
55 url(r'^group/(?P<id>\d+)/user/add/?$','add_user',
56 {'user_row_template':USER_ROW_TEMPLATE}, name="group-add-user"),
57 url(r'^group/(?P<id>\d+)/user/remove/?$','remove_user', name="group-remove-user"),