[extensions-web] extensions: Use the new get_absolute_url()



commit 4aba38da04b48cec314437316fb0fc911a09de7b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Apr 1 22:40:35 2012 -0400

    extensions: Use the new get_absolute_url()

 .../templates/extensions/detail_edit.html          |    2 +-
 sweettooth/extensions/views.py                     |    9 ++-------
 sweettooth/review/templates/review/review.html     |    2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail_edit.html b/sweettooth/extensions/templates/extensions/detail_edit.html
index ea20319..9b7ccdb 100644
--- a/sweettooth/extensions/templates/extensions/detail_edit.html
+++ b/sweettooth/extensions/templates/extensions/detail_edit.html
@@ -60,7 +60,7 @@
       <tbody>
       {% for version in all_versions %}
       <tr data-pk="{{ version.pk }}">
-        <td> <a href="{% url extensions-version-detail ext_pk=extension.pk slug=extension.slug pk=version.pk %}"> {{ version.version }} </a> </td>
+        <td> <a href="{{ version.get_absolute_url }}"> {{ version.version }} </a> </td>
         <td class="mvs">
           {% include "extensions/multiversion_status.html" %}
         </td>
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 7ae4943..c017e5a 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -246,9 +246,7 @@ def extension_version_view(request, obj, **kwargs):
         extpk = None
 
     if slug != extension.slug or extpk != extension.pk:
-        kwargs.update(dict(slug=extension.slug,
-                           ext_pk=extension.pk))
-        return redirect('extensions-version-detail', **kwargs)
+        return redirect(version)
 
     # If the user can edit the model, let him do so.
     if extension.user_can_edit(request.user):
@@ -446,10 +444,7 @@ def upload_file(request):
 
                 transaction.commit()
 
-                return redirect('extensions-version-detail',
-                                pk=version.pk,
-                                ext_pk=extension.pk,
-                                slug=extension.slug)
+                return redirect(version)
 
     else:
         form = UploadForm()
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index 86caa42..4c3bdb2 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -69,7 +69,7 @@
       {% for ver in all_versions %}
       <tr>
         <td>
-          <a href="{% url extensions-version-detail ext_pk=extension.pk slug=extension.slug pk=ver.pk %}">{{ ver.version }}</a>
+          <a href="{{ ver.get_absolute_uri }}">{{ ver.version }}</a>
         </td>
         <td>
           {% if ver.version == version.version %}



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