X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/76ed4184623336078e382f64f4e7440af5263ebf..df656ce4c8ae86e0be20cc6e497cbab1ae8ffb3b:/forum/urls.py?ds=inline diff --git a/forum/urls.py b/forum/urls.py index d1e87bf..fd82f7f 100644 --- a/forum/urls.py +++ b/forum/urls.py @@ -23,6 +23,12 @@ try: except AttributeError: admin_url = url(r'^%s(.*)' % _('nimda/'), admin.site.urls) +# Choose the user urls pattern +if bool(settings.INCLUDE_ID_IN_USER_URLS.value): + core_user_urls_prefix = r'^%s(?P\d+)/(?P.*)' +else: + core_user_urls_prefix = r'^%s(?P.*)' + core_urls = ( url(r'^$', app.readers.index, name='index'), admin_url, @@ -47,7 +53,7 @@ core_urls = ( url(r'^%s$' % _('questions/'), app.readers.questions, name='questions'), url(r'^%s%s$' % (_('questions/'), _('ask/')), app.writers.ask, name='ask'), url(r'^%s%s$' % (_('questions/'), _('related_questions/')), app.commands.related_questions, name='related_questions'), - + url(r'^%s%s$' % (_('questions/'), _('unanswered/')), app.readers.unanswered, name='unanswered'), url(r'^%s(?P[\w\-]+)/(?P\d+)/(?P.*)/$' % _('questions/'), app.readers.user_questions, name='user_questions'), @@ -94,17 +100,17 @@ core_urls = ( url(r'^%s$' % _('users/'), app.users.users, name='users'), # url(r'^%s$' % _('online_users/'), app.users.online_users, name='online_users'), - url(r'^%s(?P\d+)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'), + url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'), url(r'^%s(?P\d+)/%s$' % (_('users/'), _('award/')), app.users.award_points, name='user_award_points'), url(r'^%s(?P\d+)/%s$' % (_('users/'), _('suspend/')), app.users.suspend, name='user_suspend'), url(r'^%s(?P\d+)/%s(?P[a-z]+)/(?P[a-z]+)/$' % (_('users/'), _('powers/')), app.users.user_powers, name='user_powers'), - url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('subscriptions/')), app.users.user_subscriptions, name='user_subscriptions'), + url((core_user_urls_prefix + '/%s$') % (_('users/'), _('subscriptions/')), app.users.user_subscriptions, name='user_subscriptions'), url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('preferences/')), app.users.user_preferences, name='user_preferences'), url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('favorites/')), app.users.user_favorites, name='user_favorites'), url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('reputation/')), app.users.user_reputation, name='user_reputation'), url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('votes/')), app.users.user_votes, name='user_votes'), url(r'^%s(?P\d+)/(?P.*)/%s$' % (_('users/'), _('recent/')), app.users.user_recent, name='user_recent'), - url(r'^%s(?P\d+)/(?P.*)$' % _('users/'), app.users.user_profile, name='user_profile'), + url(core_user_urls_prefix % _('users/'), app.users.user_profile, name='user_profile'), url(r'^%s$' % _('badges/'), app.meta.badges, name='badges'), url(r'^%s(?P\d+)/(?P[\w-]+)?$' % _('badges/'), app.meta.badge, name='badge'), # (r'^admin/doc/' % _('admin/doc'), include('django.contrib.admindocs.urls')), @@ -142,7 +148,8 @@ core_urls = ( url(r'^%s%s%s$' % (_('admin/'), _('static_pages/'), _('new/')), app.admin.edit_page, name='admin_new_page'), url(r'^%s%s%s(?P\d+)/$' % (_('admin/'), _('static_pages/'), _('edit/')), app.admin.edit_page, name='admin_edit_page'), - + url(r'^%s%s%s(?P\d+)/$' % (_('admin/'), _('static_pages/'), _('delete/')), app.admin.delete_page, name='admin_delete_page'), + url(r'^%s%s(?P\w+)/$' % (_('admin/'), _('tools/')), app.admin.tools_page, name='admin_tools'), url(r'^%s%s(?P\w+)/$' % (_('admin/'), _('settings/')), app.admin.settings_set, name='admin_set'),