Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleaning up a bunch of hard coded urls to make site development easier.

  • Loading branch information...
commit d07d2c5f07c3052bfe751d5b64fc02c18bfd5c0d 1 parent 984d1e4
Justin Abrahms authored August 20, 2010
2  django_website/apps/blog/urls.py
@@ -11,5 +11,5 @@
11 11
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', info_dict),
12 12
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', info_dict),
13 13
    (r'^(?P<year>\d{4})/$', 'archive_year', info_dict),
14  
-   (r'^/?$', 'archive_index', info_dict),
  14
+   url(r'^/?$', 'archive_index', info_dict, name="blog-index"),
15 15
 )
2  django_website/apps/docs/urls.py
... ...
@@ -1,7 +1,7 @@
1 1
 from django.conf.urls.defaults import *
2 2
 
3 3
 urlpatterns = patterns('django_website.apps.docs.views',
4  
-    (r'^$',                                             'doc_index'),
  4
+    url(r'^$',                                          'doc_index', name="doc_index"),
5 5
     (r'^(?P<version>[\d.]+)/$',                         'doc_index'),
6 6
     (r'^models/$',                                      'model_index'),
7 7
     (r'^models/(?P<slug>\w+)/$',                        'model_detail'),
12  django_website/templates/base.html
@@ -24,13 +24,13 @@
24 24
 
25 25
 	<div id="container">
26 26
 		<div id="header">
27  
-			<h1 id="logo"><a href="http://www.djangoproject.com/"><img src="{{ MEDIA_URL }}img/site/hdr_logo.gif" alt="Django" /></a></h1>
  27
+            <h1 id="logo"><a href="{% url homepage %}"><img src="{{ MEDIA_URL }}img/site/hdr_logo.gif" alt="Django" /></a></h1>
28 28
 			<ul id="nav-global">
29  
-				<li id="nav-homepage"><a href="http://www.djangoproject.com/">Home</a></li>
30  
-				<li id="nav-download"><a href="http://www.djangoproject.com/download/">Download</a></li>
31  
-				<li id="nav-documentation"><a href="http://docs.djangoproject.com/">Documentation</a></li>
32  
-				<li id="nav-weblog"><a href="http://www.djangoproject.com/weblog/">Weblog</a></li>
33  
-				<li id="nav-community"><a href="http://www.djangoproject.com/community/">Community</a></li>
  29
+                <li id="nav-homepage"><a href="{% url homepage %}">Home</a></li>
  30
+                <li id="nav-download"><a href="{% url download %}">Download</a></li>
  31
+                <li id="nav-documentation"><a href="{% url doc_index %}">Documentation</a></li>
  32
+                <li id="nav-weblog"><a href="{% url blog-index %}">Weblog</a></li>
  33
+                <li id="nav-community"><a href="{% url community-index %}">Community</a></li>
34 34
 				<li id="nav-code"><a href="http://code.djangoproject.com/">Code</a></li>
35 35
 			</ul>
36 36
 		</div>
3  django_website/urls.py
@@ -32,7 +32,7 @@
32 32
 }
33 33
 
34 34
 urlpatterns = patterns('',
35  
-    (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'homepage.html'}),
  35
+    url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'homepage.html'}, name="homepage"),
36 36
     (r'^accounts/', include('django_website.apps.accounts.urls')),
37 37
     (r'^admin/(.*)', admin.site.root),
38 38
     (r'^comments/$', 'django.views.generic.list_detail.object_list', comments_info_dict),
@@ -54,6 +54,7 @@
54 54
     (r'^sitemap\.xml$', cache_page(sitemap_views.sitemap, 60 * 60 * 6), {'sitemaps': sitemaps}),
55 55
     (r'^weblog/', include('django_website.apps.blog.urls')),
56 56
     (r'^freenode\.9xJY7YIUWtwn\.html$', 'django.views.generic.simple.direct_to_template', {'template': 'freenode_tmp.html'}),
  57
+    url(r'^download$', 'django.contrib.flatpages.views.flatpage', {'url': 'download'}, name="download"),
57 58
 )
58 59
 
59 60
 if settings.DEVELOPMENT_MODE:

0 notes on commit d07d2c5

Please sign in to comment.
Something went wrong with that request. Please try again.