]> git.parisson.com Git - telemeta.git/commitdiff
make marker urls independant
authoryomguy <yomguy@parisson.com>
Mon, 21 Mar 2011 10:25:42 +0000 (11:25 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 21 Mar 2011 10:25:42 +0000 (11:25 +0100)
telemeta/urls.py
telemeta/web/base.py

index 8fcd2e3115fedd517ab44a7be5aafe97f3bc57fe..4a1ac4f76d476865e538d6abeea202dff2c03083 100644 (file)
@@ -91,8 +91,6 @@ urlpatterns = patterns('',
         dict(template='telemeta/mediaitem_copy.html'), name="telemeta-item-copy"),
     url(r'^item/add/$', web_view.item_add,
         dict(template='telemeta/mediaitem_add.html'), name="telemeta-item-add"),
-    url(r'^items/(?P<public_id>[A-Za-z0-9._-]+)/marker/(?P<marker_id>[A-Za-z0-9]+)/$', web_view.item_detail, 
-        name="telemeta-item-detail-marker"),
 
     # collections
     url(r'^collections/$', 'django.views.generic.list_detail.object_list',
@@ -204,6 +202,9 @@ urlpatterns = patterns('',
     # Playlists
     url(r'^playlists/(?P<public_id>[a-zA-Z0-9]+)/csv/$', web_view.playlist_csv_export, name="telemeta-playlist-csv-export"),
     
+    # Markers
+    url(r'^markers/(?P<marker_id>[A-Za-z0-9]+)/$', web_view.item_detail, name="telemeta-item-detail-marker"),
+        
     # RSS feeds
     url(r'rss/$', web_view.rss, name="telemeta-rss"),
 )
index e8797da09e276b18467453a4e73a2e678059c033..cac1f64e1bb6b5d008d8b078a0cea9c85ea04142 100644 (file)
@@ -218,9 +218,13 @@ class WebView(object):
              next = item.public_id
         return previous, next
         
-    def item_detail(self, request, public_id, marker_id=None, template='telemeta/mediaitem_detail.html'):
+    def item_detail(self, request, public_id=None, marker_id=None, template='telemeta/mediaitem_detail.html'):
         """Show the details of a given item"""
-        item = MediaItem.objects.get(public_id=public_id)
+        if not public_id and marker_id:
+            marker = MediaItemMarker(public_id=marker_id)
+            item = marker.item
+        else:
+            item = MediaItem.objects.get(public_id=public_id)
         
         # Get TimeSide processors
         formats = []