[extensions-web] Use Extension.get_absolute_url() more



commit 218c3c818d8e450fb68a60efafa8ff89b48980b3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 2 00:04:50 2012 -0400

    Use Extension.get_absolute_url() more

 .../auth/templates/registration/profile.html       |    2 +-
 sweettooth/extensions/feeds.py                     |    4 ----
 .../extensions/templates/extensions/detail.html    |    4 ++--
 sweettooth/extensions/views.py                     |    4 ++--
 4 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/auth/templates/registration/profile.html b/sweettooth/auth/templates/registration/profile.html
index 62bfe51..b66b810 100644
--- a/sweettooth/auth/templates/registration/profile.html
+++ b/sweettooth/auth/templates/registration/profile.html
@@ -21,7 +21,7 @@
   <ul>
     {% for extension in extensions %}
     <li class="extension profile">
-      <h4 class="extension-name"><a href="{% url extensions-detail pk=extension.pk %}">
+      <h4 class="extension-name"><a href="{{ extension.get_absolute_url }}">
           <img src="{{ extension.icon.url }}" class="icon">{{ extension.name }}
       </a></h4>
       <p class="description">
diff --git a/sweettooth/extensions/feeds.py b/sweettooth/extensions/feeds.py
index 35e89fc..fccd8bb 100644
--- a/sweettooth/extensions/feeds.py
+++ b/sweettooth/extensions/feeds.py
@@ -16,7 +16,3 @@ class LatestExtensionsFeed(Feed):
 
     def item_description(self, item):
         return item.description
-
-    def item_link(self, item):
-        return reverse('extensions-detail', kwargs=dict(pk=item.pk,
-                                                        slug=item.slug))
diff --git a/sweettooth/extensions/templates/extensions/detail.html b/sweettooth/extensions/templates/extensions/detail.html
index b665445..226c4a0 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -8,12 +8,12 @@
    {% spaceless %}
     <p class="message error">
       This version of {{ extension.name }} was rejected.
-      <a href="{% url extensions-detail pk=extension.pk %}">View the latest accepted version.</a>
+      <a href="{{ extension.get_absolute_url }}">View the latest accepted version.</a>
     </p>
     {% endspaceless %}
   {% else %} {% if old_version %}
     <p class="message warning">
-      You are viewing an old version of <a href="{% url extensions-detail pk=extension.pk %}">{{ extension.name }}</a>
+      You are viewing an old version of <a href="{{ extension.get_absolute_url }}">{{ extension.name }}</a>
     </p>
   {% endif %} {% endif %}
 {% endblock %}
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index c017e5a..291954d 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -211,7 +211,7 @@ def extension_view(request, obj, **kwargs):
     if slug != extension.slug:
         kwargs.update(dict(slug=extension.slug,
                            pk=extension.pk))
-        return redirect('extensions-detail', **kwargs)
+        return redirect(extension)
 
     # If the user can edit the model, let him do so.
     if extension.user_can_edit(request.user):
@@ -350,7 +350,7 @@ def ajax_details(extension, version=None):
                    creator = extension.creator.username,
                    creator_url = reverse('auth-profile', kwargs=dict(user=extension.creator.username)),
                    description = extension.description,
-                   link = reverse('extensions-detail', kwargs=dict(pk=extension.pk)),
+                   link = extension.get_absolute_url(),
                    icon = extension.icon.url,
                    shell_version_map = extension.visible_shell_version_map)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]