From b9fdcd06222c674d5fabcf5a4ab6bc55f268c757 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 22 Feb 2011 15:29:08 -0600 Subject: Modularize URLs Make some additional URL config files that can be included so we aren't trying to do so much in the top level config. This also allows us to branch a bit more rather than go linear down the rather lengthy list. Signed-off-by: Dan McGee --- urls.py | 65 ++++++++++++++++++++++++----------------------------------------- 1 file changed, 24 insertions(+), 41 deletions(-) (limited to 'urls.py') diff --git a/urls.py b/urls.py index f18500fd..da937666 100644 --- a/urls.py +++ b/urls.py @@ -17,47 +17,24 @@ } admin.autodiscover() - -urlpatterns = patterns('packages.views', - (r'^groups/$', 'groups'), - (r'^groups/(?P[A-z0-9]+)/$', 'groups'), - (r'^groups/(?P[A-z0-9]+)/(?P[A-z0-9\-+.]+)/$', - 'group_details'), - - (r'^opensearch/packages/$', 'opensearch', {}, 'opensearch-packages'), -) - -urlpatterns += patterns('todolists.views', - (r'^todolists/$', 'public_list'), -) - -urlpatterns += patterns('mirrors.views', - (r'^mirrors/status/$', 'status', {}, 'mirror-status'), - (r'^mirrors/status/json/$', 'status_json', {}, 'mirror-status-json'), - - (r'^mirrors/$', 'mirrors', {}, 'mirrors-list'), - (r'^mirrors/(?P[\.\-\w]+)/$', 'mirror_details'), - - (r'^mirrorlist/$', 'generate_mirrorlist', {}, 'mirrorlist'), - (r'^mirrorlist/all/$', 'find_mirrors', {'countries': ['all']}), - (r'^mirrorlist/all/ftp/$', 'find_mirrors', - {'countries': ['all'], 'protocols': ['ftp']}), - (r'^mirrorlist/all/http/$', 'find_mirrors', - {'countries': ['all'], 'protocols': ['http']}), -) - -# Feeds and sitemaps -urlpatterns += patterns('', - (r'^feeds/$', 'public.views.feeds', {}, 'feeds-list'), - (r'^feeds/news/$', NewsFeed()), - (r'^feeds/packages/$', PackageFeed()), - (r'^feeds/packages/(?P[A-z0-9]+)/$', +urlpatterns = [] + +# Feeds patterns, used later +feeds_patterns = patterns('', + (r'^$', 'public.views.feeds', {}, 'feeds-list'), + (r'^news/$', NewsFeed()), + (r'^packages/$', PackageFeed()), + (r'^packages/(?P[A-z0-9]+)/$', PackageFeed()), - (r'^feeds/packages/(?P[A-z0-9]+)/(?P[A-z0-9\-]+)/$', + (r'^packages/(?P[A-z0-9]+)/(?P[A-z0-9\-]+)/$', PackageFeed()), - (r'^sitemap.xml$', 'django.contrib.sitemaps.views.index', +) + +# Sitemaps +urlpatterns += patterns('django.contrib.sitemaps.views', + (r'^sitemap.xml$', 'index', {'sitemaps': sitemaps}), - (r'^sitemap-(?P
.+)\.xml$', 'django.contrib.sitemaps.views.sitemap', + (r'^sitemap-(?P
.+)\.xml$', 'sitemap', {'sitemaps': sitemaps}), ) @@ -88,13 +65,19 @@ # Includes and other remaining stuff urlpatterns += patterns('', - (r'^admin/', include(admin.site.urls)), - (r'^jsi18n/$', 'django.views.i18n.null_javascript_catalog'), - + (r'^jsi18n/$', 'django.views.i18n.null_javascript_catalog'), + (r'^admin/', include(admin.site.urls)), (r'^devel/', include('devel.urls')), + (r'^feeds/', include(feeds_patterns)), + (r'^groups/', include('packages.urls_groups')), + (r'^mirrorlist/',include('mirrors.urls_mirrorlist')), + (r'^mirrors/', include('mirrors.urls')), (r'^news/', include('news.urls')), (r'^packages/', include('packages.urls')), (r'^todo/', include('todolists.urls')), + (r'^opensearch/packages/$', 'packages.views.opensearch', + {}, 'opensearch-packages'), + (r'^todolists/$','todolists.views.public_list'), ) if settings.DEBUG == True: -- cgit v1.2.3-54-g00ecf From 5cd223680e35e90bfc39ae22a4638204d0beaa98 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 27 Feb 2011 11:52:27 -0600 Subject: Slight refactor of user list views Signed-off-by: Dan McGee --- public/views.py | 36 ++++++++++++++++++++++++------------ urls.py | 6 +++--- 2 files changed, 27 insertions(+), 15 deletions(-) (limited to 'urls.py') diff --git a/public/views.py b/public/views.py index 551e1e18..46291b88 100644 --- a/public/views.py +++ b/public/views.py @@ -5,6 +5,7 @@ from django.contrib.auth.models import User from django.db.models import Q +from django.http import Http404 from django.views.generic import list_detail from django.views.generic.simple import direct_to_template @@ -17,23 +18,34 @@ def index(request): } return direct_to_template(request, 'public/index.html', context) -def userlist(request, type='Developers'): +USER_LISTS = { + 'devs': { + 'user_type': 'Developers', + 'description': "This is a list of the current Arch Linux Developers. They maintain the [core] and [extra] package repositories in addition to doing any other developer duties.", + }, + 'tus': { + 'user_type': 'Trusted Users', + 'description': "Here are all your friendly Arch Linux Trusted Users who are in charge of the [community] repository.", + }, + 'fellows': { + 'user_type': 'Fellows', + 'description': "Below you can find a list of ex-developers (aka project fellows). These folks helped make Arch what it is today. Thanks!", + }, +} + +def userlist(request, type='devs'): users = User.objects.order_by('username').select_related('userprofile') - if type == 'Developers': + if type == 'devs': users = users.filter(is_active=True, groups__name="Developers") - msg = "This is a list of the current Arch Linux Developers. They maintain the [core] and [extra] package repositories in addition to doing any other developer duties." - elif type == 'Trusted Users': + elif type == 'tus': users = users.filter(is_active=True, groups__name="Trusted Users") - msg = "Here are all your friendly Arch Linux Trusted Users who are in charge of the [community] repository." - elif type == 'Fellows': + elif type == 'fellows': users = users.filter(is_active=False, groups__name__in=["Developers", "Trusted Users"]) - msg = "Below you can find a list of ex-developers (aka project fellows). These folks helped make Arch what it is today. Thanks!" + else: + raise Http404 - context = { - 'user_type': type, - 'description': msg, - 'users': users, - } + context = USER_LISTS[type].copy() + context['users'] = users return direct_to_template(request, 'public/userlist.html', context) def donate(request): diff --git a/urls.py b/urls.py index da937666..3608da67 100644 --- a/urls.py +++ b/urls.py @@ -56,9 +56,9 @@ (r'^about/$', direct_to_template, {'template': 'public/about.html'}, 'page-about'), (r'^art/$', direct_to_template, {'template': 'public/art.html'}, 'page-art'), (r'^svn/$', direct_to_template, {'template': 'public/svn.html'}, 'page-svn'), - (r'^developers/$', 'userlist', { 'type':'Developers' }, 'page-devs'), - (r'^trustedusers/$', 'userlist', { 'type':'Trusted Users' }, 'page-tus'), - (r'^fellows/$', 'userlist', { 'type':'Fellows' }, 'page-fellows'), + (r'^developers/$', 'userlist', { 'type':'devs' }, 'page-devs'), + (r'^trustedusers/$', 'userlist', { 'type':'tus' }, 'page-tus'), + (r'^fellows/$', 'userlist', { 'type':'fellows' }, 'page-fellows'), (r'^donate/$', 'donate', {}, 'page-donate'), (r'^download/$', 'download', {}, 'page-download'), ) -- cgit v1.2.3-54-g00ecf From c722d8bf9e2f647d5cd8fa3a85a17d0cb3b5b101 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 4 Mar 2011 09:36:18 -0600 Subject: Remove multiple account login/logout URLs And slightly spruce up the logout template with a header. Signed-off-by: Dan McGee --- templates/base.html | 2 +- templates/registration/logout.html | 4 +++- urls.py | 4 ---- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'urls.py') diff --git a/templates/base.html b/templates/base.html index 03795dd9..88bb3414 100644 --- a/templates/base.html +++ b/templates/base.html @@ -44,7 +44,7 @@ title="arch-dev mailing list archives">Archives
  • Mirrors
  • Profile
  • -
  • Logout
  • +
  • Logout
  • {% endif %} diff --git a/templates/registration/logout.html b/templates/registration/logout.html index f8e07621..e890ce99 100644 --- a/templates/registration/logout.html +++ b/templates/registration/logout.html @@ -3,7 +3,9 @@ {% block content %}
    -

    Logout successful.

    +

    Developer Logout

    + +

    Logout was successful.

    {% endblock %} diff --git a/urls.py b/urls.py index 3608da67..33319263 100644 --- a/urls.py +++ b/urls.py @@ -42,12 +42,8 @@ urlpatterns += patterns('django.contrib.auth.views', (r'^login/$', 'login', { 'template_name': 'registration/login.html'}), - (r'^accounts/login/$', 'login', { - 'template_name': 'registration/login.html'}), (r'^logout/$', 'logout', { 'template_name': 'registration/logout.html'}), - (r'^accounts/logout/$', 'logout', { - 'template_name': 'registration/logout.html'}), ) # Public pages -- cgit v1.2.3-54-g00ecf