class PlaylistResource(ModelCore):
"Playlist components"
- RESOURCE_TYPE_CHOICES = (('item', 'item'), ('collection', 'collection'))
+ RESOURCE_TYPE_CHOICES = (('item', 'item'), ('collection', 'collection'), ('marker', 'marker'))
element_type = 'playlist_resource'
public_id = CharField(_('public_id'), required=True)
playlist = ForeignKey('Playlist', related_name="resources", verbose_name=_('playlist'))
- resource_type = CharField(_('resource type'), choices=RESOURCE_TYPE_CHOICES, required=True)
- resource_id = CharField(_('resource'), required=True)
+ resource_type = CharField(_('resource_type'), choices=RESOURCE_TYPE_CHOICES, required=True)
+ resource_id = CharField(_('resource_id'), required=True)
class Meta(MetaCore):
db_table = 'playlist_resources'
db_table = 'media_markers'
def __unicode__(self):
- return self.time + ' : ' + self.description + '(' + self.author + ')'
+ return self.title
class Search(ModelCore):
"Keywork search"
{% for resource in playlist.resources %}
<tr>
+ <td>
{% if resource.type == "item" %}
- <td><a href="{% url telemeta-item-detail resource.element.public_id %}">{{ resource.element }}</td>
- {% else %}
- <td><a href="{% url telemeta-collection-detail resource.element.public_id %}">{{ resource.element }}</td>
+ <a href="{% url telemeta-item-detail resource.element.public_id %}">{{ resource.element }}</a>
+ {% endif %}
+ {% if resource.type == "collection" %}
+ <a href="{% url telemeta-collection-detail resource.element.public_id %}">{{ resource.element }}</a>
{% endif %}
+ {% if resource.type == "marker" %}
+ {{ resource.element }}
+ {% endif %}
+ </td>
<td>{{ resource.type }}</td>
<td>
- {{ resource.element.code|default:resource.element.old_code }}
+ {{ resource.element.public_id }}
</td>
<td>{{ resource.element.apparent_collector }}</td>
name="telemeta-items"),
url(r'^items/(?P<public_id>[A-Za-z0-9._-]+)/$', web_view.item_detail,
name="telemeta-item-detail"),
- 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"),
url(r'^items/(?P<public_id>[A-Za-z0-9._-]+)/dc/$', web_view.item_detail,
{'template': 'telemeta/mediaitem_detail_dc.html'},
name="telemeta-item-dublincore"),
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',
m.name = playlist['name']
m.description = playlist['description']
m.author = request.user
+ if playlist['is_current'] == 'True':
+ m.is_current = True
+ else:
+ m.is_current = False
m.save()
else:
raise 'Error : Bad playlist dictionnary'
resources = []
for resource in playlist_resources:
if resource.resource_type == 'item':
- element = MediaItem.objects.get(public_id=resource.resource_id)
+ element = MediaItem.objects.get(pk=resource.resource_id)
if resource.resource_type == 'collection':
- element = MediaCollection.objects.get(public_id=resource.resource_id)
+ element = MediaCollection.objects.get(pk=resource.resource_id)
+ if resource.resource_type == 'marker':
+ element = MediaItemMarker.objects.get(pk=resource.resource_id)
resources.append({'element': element, 'type': resource.resource_type})
- playlists.append({'name': playlist.name, 'resources': resources})
+ playlists.append({'name': playlist.name, 'description': playlist.description,
+ 'is_current': playlist.is_current, 'resources': resources})
return playlists
@jsonrpc_method('telemeta.update_playlist')