Use media.id for collecting media too.
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 24 Feb 2013 15:08:55 +0000 (16:08 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 24 Feb 2013 15:22:48 +0000 (16:22 +0100)
Also remove some useless whitespace while at it.

mediagoblin/templates/mediagoblin/user_pages/media_collect.html
mediagoblin/templates/mediagoblin/utils/collections.html
mediagoblin/user_pages/routing.py
mediagoblin/user_pages/views.py

index 0fa0a9f4c613aa72fc5c8c60c78f7092362fb362..b4c9671cbcdd5fa7dde8ffffea39907cee4f2571 100644 (file)
@@ -33,7 +33,7 @@
 {% block mediagoblin_content %}
   <form action="{{ request.urlgen('mediagoblin.user_pages.media_collect',
                                  user=media.get_uploader.username,
-                                 media=media.id) }}"
+                                 media_id=media.id) }}"
         method="POST" enctype="multipart/form-data">
     <div class="form_box">
       <h1>
index db23625b3733ad08e6ebbb48d48f892eae623165..2cff7a298c17139377bd9b0f0416a0c1b6145c57 100644 (file)
@@ -20,7 +20,7 @@
   {% if media.collections %}
     <h3>{% trans %}Collected in{% endtrans %}</h3>
     <p>
-      {% for collection in media.collections %}
+      {%- for collection in media.collections %}
         {% if loop.last %}
           {# the 'and' should only appear if there is more than one collections #}
           {% if media.collections|length > 1 %}
         {% else %}
           <a href="{{ collection.url_for_self(request.urlgen) }}">{{ collection['title'] }}</a> &middot;
         {% endif %}
-      {% endfor %}
+      {%- endfor %}
     </p>
-  {% endif %}
-  {% if request.user %}
+  {%- endif %}
+  {%- if request.user %}
     <p>
       <a type="submit" href="{{ request.urlgen('mediagoblin.user_pages.media_collect', 
                                   user=media.get_uploader.username,
-                                  media=media.id) }}"
+                                  media_id=media.id) }}"
          class="button_action">
         {% trans %}Add to a collection{% endtrans %}
       </a>
     </p>
-  {% endif %}
+  {%- endif %}
 {% endblock %}
index 7de3ab60beb493ea8dc57efd960a7ae7fe9addf5..9cb665b51519a2c29efafdb808c601f9dc0ef8b7 100644 (file)
@@ -50,7 +50,7 @@ add_route('mediagoblin.user_pages.atom_feed',
           'mediagoblin.user_pages.views:atom_feed')
 
 add_route('mediagoblin.user_pages.media_collect',
-          '/u/<string:user>/m/<string:media>/collect/',
+          '/u/<string:user>/m/<int:media_id>/collect/',
           'mediagoblin.user_pages.views:media_collect')
 
 add_route('mediagoblin.user_pages.collection_list',
index 601eef1775b183a0c709ab09104710cac2de4a43..bbc3259ae082a07ce441f601e88019a49583a8e3 100644 (file)
@@ -180,7 +180,7 @@ def media_post_comment(request, media):
     return redirect(request, location=media.url_for_self(request.urlgen))
 
 
-@get_user_media_entry
+@get_media_entry_by_id
 @require_active_login
 def media_collect(request, media):
     """Add media to collection submission"""