changeset 36:bc0137b6c264

Shuffle URLs around, make them more consistent
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Wed, 07 Jul 2010 09:23:03 -0500
parents 290dd9208cc4
children ba2dad0d7f2a
files apps/free_license/views.py apps/profile/urls.py templates/profile/edit-user.djhtml templates/profile/user.djhtml templates/whitebox.djhtml urls.py
diffstat 6 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/apps/free_license/views.py
+++ b/apps/free_license/views.py
@@ -1,1 +1,4 @@
 # Create your views here.
+
+def list(request):
+    pass
new file mode 100644
--- /dev/null
+++ b/apps/profile/urls.py
@@ -0,0 +1,6 @@
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('agora.apps.profile.views',
+    (r'^editprofile/(?P<user>\w*)/$', 'editprofile'),
+    (r'^(?P<user>\w*)/$',             'showprofile'),
+)
--- a/templates/profile/edit-user.djhtml
+++ b/templates/profile/edit-user.djhtml
@@ -33,7 +33,7 @@
   <p class="explanation">
     By default, all of your submissions will be under the following
     license, and will be displayed next to your submissions.
-    <a href="/licenses">
+    <a href="{% url agora.apps.free_license.views.list %}">
       Here is a thorough explanation of the available licenses.
     </a>
   </p>
--- a/templates/profile/user.djhtml
+++ b/templates/profile/user.djhtml
@@ -54,7 +54,11 @@
     </h5>
     <ul>
       {% for b in bundles %}
-      <li> <a href="/{{profile.user.username}}/{{b.name}}">{{b.name}} </a></li>
+      <li>
+        <a href="{% url agora.apps.bundle.views.detail profile.user b %}">
+          {{b.name}}
+        </a>
+      </li>
       {% endfor %}
     </ul>
     {% endif %}
@@ -64,6 +68,7 @@
     </h5>
     <ul>
       {% for s in snippets %}
+      {# FIXME: Use an urlconf for snippets #}
       <li><a href="/snippet/{{s}}"}{{s}}</a></li>
       {% endfor %}
       {% endif %}
--- a/templates/whitebox.djhtml
+++ b/templates/whitebox.djhtml
@@ -15,7 +15,8 @@
 {% if user.is_authenticated %}
 <a href="{% url auth_logout %}" id="nav-logout">Logout</a>
 <small>
-  (<a href="/{{user.username}}" id="nav-username">{{user.username}}</a>)
+  (<a href="{% url agora.apps.profile.views.showprofile user %}" 
+      id="nav-username">{{user.username}}</a>)
 </small>
 {% else %}
 <a href="{% url auth_login %}?next={{ request.path }}">Log in</a>
--- a/urls.py
+++ b/urls.py
@@ -9,7 +9,6 @@
       'django.views.generic.simple.direct_to_template',
       {'template': 'index.djhtml'}),
 
-
      (r'^admin/doc/', include('django.contrib.admindocs.urls')),
      (r'^admin/', include(admin.site.urls)),
 
@@ -18,8 +17,9 @@
 
      (r'^accounts/', include('registration.urls')),
 
-     (r'^editprofile/(?P<user>\w*)/$', 'agora.apps.profile.views.editprofile'),
-     (r'^(?P<user>\w*)/$',      'agora.apps.profile.views.showprofile'),
+     (r'^licenses/', include('agora.apps.free_license.urls')),
+
+     (r'^user/', include('agora.apps.profile.urls')),
 
      (r'^', include('agora.apps.bundle.urls')),