Commit 27f98bdd authored by Claude Paroz's avatar Claude Paroz

Modernized urls.py syntax

parent 6c1b8e45
# -*- coding: utf-8 -*-
from django.conf.urls import include, patterns, url
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic import TemplateView
from django.views.static import serve
admin.autodiscover()
from common import views as common_views
from stats import views as stats_views
urlpatterns = patterns('',
url(
regex = r'^$',
view = 'common.views.index',
name = 'home'),
url(
regex = r'^about/$',
view = 'common.views.about',
name = 'about'),
url(
regex = r'^login/$',
view = 'common.views.site_login',
name = 'login'),
url(
regex = r'^register/$',
view = 'common.views.site_register',
name = 'register'),
url(
regex = r'^help/(?P<topic>\w+)/$',
view = 'common.views.help',
name = 'help'),
url(
regex = r'^register/success$',
view = TemplateView.as_view(template_name="registration/register_success.html"),
name = 'register_success'),
url(
regex = r'^register/activate/(?P<key>\w+)$',
view = 'common.views.activate_account',
name = 'register_activation'),
url(
regex = r'^password_reset/$',
view = 'django.contrib.auth.views.password_reset',
kwargs = {'template_name':'registration/password_reset_form.html'},
urlpatterns = [
url(r'^$',
common_views.index,
name='home'),
url(r'^about/$',
common_views.about,
name='about'),
url(r'^login/$',
common_views.site_login,
name='login'),
url(r'^register/$',
common_views.site_register,
name='register'),
url(r'^help/(?P<topic>\w+)/$',
common_views.help,
name='help'),
url(r'^register/success$',
TemplateView.as_view(template_name="registration/register_success.html"),
name='register_success'),
url(r'^register/activate/(?P<key>\w+)$',
common_views.activate_account,
name='register_activation'),
url(r'^password_reset/$',
auth_views.password_reset,
kwargs={'template_name':'registration/password_reset_form.html'},
name='password_reset'),
url(
regex = r'^password_reset/done/$',
view = 'django.contrib.auth.views.password_reset_done',
kwargs = {'template_name':'registration/password_reset_done.html'},
url(r'^password_reset/done/$',
auth_views.password_reset_done,
kwargs={'template_name':'registration/password_reset_done.html'},
name='password_reset_done'),
url(
regex = r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
view = 'django.contrib.auth.views.password_reset_confirm',
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
auth_views.password_reset_confirm,
name='password_reset_confirm'),
url(
regex = r'^reset/done/$',
view = 'django.contrib.auth.views.password_reset_complete',
url(r'^reset/done/$',
auth_views.password_reset_complete,
name='password_reset_complete'),
url(r'^teams/', include('teams.urls')),
url(r'^people/', include('people.urls')),
url(# users is the hardcoded url in the contrib.auth User class, making it identical to /people
......@@ -62,62 +56,50 @@ urlpatterns = patterns('',
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^rss/', include('feeds.urls')),
)
]
urlpatterns += patterns('stats.views',
url(
regex = r'^module/(?P<format>(html|json|xml))?/?$',
view = 'modules',
name = 'modules'),
url(
regex = r'^module/po/(?P<module_name>[\w\-\+]+)/(?P<domain>[\w~\-]+)/(?P<branch_name>[\w\-\.]+)/(?P<filename>.*)$',
view = 'dynamic_po',
name = 'dynamic_po'),
url(
regex = r'^module/(?P<module_name>[\w\-\+]+)/$',
view = 'module',
name = 'module'),
url(
regex = r'^module/(?P<module_name>[\w\-\+]+)/edit/branches/$',
view = 'module_edit_branches',
name = 'module_edit_branches'),
url(
regex = r'^module/(?P<module_name>[\w\-\+]+)/branch/(?P<branch_name>[\w\-\.]+)/$',
view = 'module_branch'),
url(
regex = r'^branch/(?P<branch_id>\d+)/refresh/$',
view = 'branch_refresh',
name = 'branch_refresh'),
url(
regex = r'^module/(?P<module_name>[\w\-\+]+)/(?P<potbase>[\w~-]+)/(?P<branch_name>[\w\-\.]+)/(?P<langcode>[\w@]+)/images/$',
view = 'docimages',
name = 'docimages'),
url(
regex = r'^releases/(?P<format>(html|json|xml))?/?$',
view = 'releases',
urlpatterns += [
url(r'^module/(?P<format>(html|json|xml))?/?$',
stats_views.modules,
name='modules'),
url(r'^module/po/(?P<module_name>[\w\-\+]+)/(?P<domain>[\w~\-]+)/(?P<branch_name>[\w\-\.]+)/(?P<filename>.*)$',
stats_views.dynamic_po,
name='dynamic_po'),
url(r'^module/(?P<module_name>[\w\-\+]+)/$',
stats_views.module,
name='module'),
url(r'^module/(?P<module_name>[\w\-\+]+)/edit/branches/$',
stats_views.module_edit_branches,
name='module_edit_branches'),
url(r'^module/(?P<module_name>[\w\-\+]+)/branch/(?P<branch_name>[\w\-\.]+)/$',
stats_views.module_branch),
url(r'^branch/(?P<branch_id>\d+)/refresh/$',
stats_views.branch_refresh,
name='branch_refresh'),
url( r'^module/(?P<module_name>[\w\-\+]+)/(?P<potbase>[\w~-]+)/(?P<branch_name>[\w\-\.]+)/(?P<langcode>[\w@]+)/images/$',
stats_views.docimages,
name='docimages'),
url(r'^releases/(?P<format>(html|json|xml))?/?$',
stats_views.releases,
name = 'releases'),
url(
regex = r'^releases/(?P<release_name>[\w-]+)/(?P<format>(html|xml))?/?$',
view = 'release',
url(r'^releases/(?P<release_name>[\w-]+)/(?P<format>(html|xml))?/?$',
stats_views.release,
name = 'release'),
url(
regex = r'^releases/compare/(?P<dtype>\w+)/(?P<rels_to_compare>[/\w-]+)/$',
view = 'compare_by_releases'),
)
url(r'^releases/compare/(?P<dtype>\w+)/(?P<rels_to_compare>[/\w-]+)/$',
stats_views.compare_by_releases),
]
if 'django_openid_auth' in settings.INSTALLED_APPS:
urlpatterns += patterns('',
urlpatterns += [
(r'^openid/', include('django_openid_auth.urls')),
)
]
if settings.STATIC_SERVE:
urlpatterns += patterns('',
url(
regex = r'^media/(?P<path>.*)$',
view = 'django.views.static.serve',
kwargs = {'document_root': settings.MEDIA_ROOT}),
url(
regex = r'^POT/(?P<path>.*)$',
view = 'django.views.static.serve',
kwargs = {'document_root': settings.POTDIR}),
)
urlpatterns += [
url(r'^media/(?P<path>.*)$',
serve,
kwargs={'document_root': settings.MEDIA_ROOT}),
url(r'^POT/(?P<path>.*)$',
serve,
kwargs={'document_root': settings.POTDIR}),
]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
from vertimus.feeds import LatestActionsByLanguage, LatestActionsByTeam
urlpatterns = patterns('',
urlpatterns = [
url(r'^languages/(?P<locale>.*)/$', LatestActionsByLanguage(), name='lang_feed'),
url(r'^teams/(?P<team_name>.*)/$', LatestActionsByTeam(), name='team_feed'),
)
]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
urlpatterns = patterns('',
url(
regex = r'^$',
view = 'languages.views.languages',
name = 'languages'),
url(
regex = r'^(?P<locale>[\w\-@]+)/all/(?P<dtype>(ui|ui-part|doc)+)/$',
view = 'languages.views.language_all',
name = 'language_all'),
url(
regex = r'^(?P<locale>[\w\-@]+)/rel-archives/$',
view = 'languages.views.release_archives',
name = 'language_release_archives'),
url(
regex = r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|ui-part|doc)+)/$',
view = 'languages.views.language_release',
name = 'language_release'),
url(
regex = r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+).xml$',
view = 'languages.views.language_release_xml'),
url(
regex = r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|ui-part|doc)+).tar.gz$',
view = 'languages.views.language_release_tar',
name = 'language_release_tar'),
url(
regex = r'^(?P<team_slug>[\w\-@]+)/$',
view = 'teams.views.team'),
)
from languages import views
from teams import views as team_views
urlpatterns = [
url(r'^$',
views.languages,
name='languages'),
url(r'^(?P<locale>[\w\-@]+)/all/(?P<dtype>(ui|ui-part|doc)+)/$',
views.language_all,
name='language_all'),
url(r'^(?P<locale>[\w\-@]+)/rel-archives/$',
views.release_archives,
name='language_release_archives'),
url(r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|ui-part|doc)+)/$',
views.language_release,
name='language_release'),
url(r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+).xml$',
views.language_release_xml),
url(r'^(?P<locale>[\w\-@]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|ui-part|doc)+).tar.gz$',
views.language_release_tar,
name='language_release_tar'),
url(r'^(?P<team_slug>[\w\-@]+)/$',
team_views.team),
]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from people import views
# Regex order is really important here
urlpatterns = patterns('people.views',
url(
r'^detail_change/$',
urlpatterns = [
url(r'^detail_change/$',
login_required(views.PersonEditView.as_view()),
name = 'person_detail_change'),
url(
regex = r'^password_change/$',
view = 'person_password_change',
name='person_detail_change'),
url(r'^password_change/$',
views.person_password_change,
name='person_password_change'),
url(
regex = r'^team_join/$',
view = 'person_team_join',
url(r'^team_join/$',
views.person_team_join,
name='person_team_join'),
url(
regex = r'^team_leave/(?P<team_slug>[\w\-@]+)/$',
view = 'person_team_leave',
url(r'^team_leave/(?P<team_slug>[\w\-@]+)/$',
views.person_team_leave,
name='person_team_leave'),
url(
r'^(?P<pk>\d+)/$',
url(r'^(?P<pk>\d+)/$',
views.PersonDetailView.as_view(),
name = 'person_detail_id'),
name='person_detail_id'),
# Equivalent to the previous, but using username instead of user pk
url(
r'^(?P<slug>[\w@\.\-]+)/$',
url(r'^(?P<slug>[\w@\.\-]+)/$',
views.PersonDetailView.as_view(),
name = 'person_detail_username'),
)
name='person_detail_username'),
urlpatterns += patterns('',
url(r'^$', views.PeopleListView.as_view(), name='people'),
)
url(r'^$',
views.PeopleListView.as_view(),
name='people'),
]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
urlpatterns = patterns('teams.views',
url(
regex = r'^(?P<format>(xml|json))?/?$',
view = 'teams',
name = 'teams'),
url(
regex = r'^(?P<team_slug>[\w\-@]+)/$',
view = 'team',
name = 'team_slug'),
url(
regex = r'^(?P<team_slug>[\w\-@]+)/edit/',
view = 'team_edit',
name = 'team_edit'),
)
from teams import views
urlpatterns = [
url(r'^(?P<format>(xml|json))?/?$',
views.teams,
name='teams'),
url(r'^(?P<team_slug>[\w\-@]+)/$',
views.team,
name='team_slug'),
url(r'^(?P<team_slug>[\w\-@]+)/edit/$',
views.team_edit,
name='team_edit'),
]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
urlpatterns = patterns('vertimus.views',
url(
regex = r'^(?P<stats_id>\d+)/(?P<lang_id>\d+)$',
view = 'vertimus_by_stats_id',
name = 'vertimus_by_stats_id'),
url(
regex = r'^(?P<branch_id>\d+)/(?P<domain_id>\d+)/(?P<language_id>\d+)',
view = 'vertimus_by_ids',
name = 'vertimus_by_ids'),
url(
regex = r'^diff/(?P<action_id_1>\d+)/(?P<action_id_2>\d+)/(?P<level>\d+)/$',
view = 'vertimus_diff',
name = 'vertimus_diff'),
url(
regex = r'^uploads/(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)/latest/$',
view = 'latest_uploaded_po',
name = 'latest_uploaded_po'),
url(
regex = '^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)/level(?P<level>\d+)/$',
view = 'vertimus_by_names',
name = 'vertimus_archives_by_names'),
url(
regex = r'^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)',
view = 'vertimus_by_names',
name = 'vertimus_by_names'),
url(
regex = r'^(?P<locale>[\w\-@]+)/activity_summary/$',
view = 'activity_by_language',
name = 'activity_by_language'),
)
from vertimus import views
urlpatterns = [
url(r'^(?P<stats_id>\d+)/(?P<lang_id>\d+)$',
views.vertimus_by_stats_id,
name='vertimus_by_stats_id'),
url(r'^(?P<branch_id>\d+)/(?P<domain_id>\d+)/(?P<language_id>\d+)',
views.vertimus_by_ids,
name='vertimus_by_ids'),
url(r'^diff/(?P<action_id_1>\d+)/(?P<action_id_2>\d+)/(?P<level>\d+)/$',
views.vertimus_diff,
name='vertimus_diff'),
url(r'^uploads/(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)/latest/$',
views.latest_uploaded_po,
name='latest_uploaded_po'),
url('^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)/level(?P<level>\d+)/$',
views.vertimus_by_names,
name='vertimus_archives_by_names'),
url(r'^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\-@]+)',
views.vertimus_by_names,
name='vertimus_by_names'),
url(r'^(?P<locale>[\w\-@]+)/activity_summary/$',
views.activity_by_language,
name='activity_by_language'),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment