From: yomguy Date: Mon, 21 Mar 2011 10:25:42 +0000 (+0100) Subject: make marker urls independant X-Git-Tag: 1.1~346 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=94cd034f2e8f7e5553cd6fe6cf41ae38ba050fc3;p=telemeta.git make marker urls independant --- diff --git a/telemeta/urls.py b/telemeta/urls.py index 8fcd2e31..4a1ac4f7 100644 --- a/telemeta/urls.py +++ b/telemeta/urls.py @@ -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[A-Za-z0-9._-]+)/marker/(?P[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[a-zA-Z0-9]+)/csv/$', web_view.playlist_csv_export, name="telemeta-playlist-csv-export"), + # Markers + url(r'^markers/(?P[A-Za-z0-9]+)/$', web_view.item_detail, name="telemeta-item-detail-marker"), + # RSS feeds url(r'rss/$', web_view.rss, name="telemeta-rss"), ) diff --git a/telemeta/web/base.py b/telemeta/web/base.py index e8797da0..cac1f64e 100644 --- a/telemeta/web/base.py +++ b/telemeta/web/base.py @@ -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 = []