]> git.parisson.com Git - mezzo.git/commitdiff
Add LiveStreaming MVC
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 14 Mar 2017 17:29:06 +0000 (18:29 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 14 Mar 2017 17:29:06 +0000 (18:29 +0100)
app/organization/media/admin.py
app/organization/media/migrations/0014_livestreaming.py [new file with mode: 0644]
app/organization/media/models.py
app/organization/media/translation.py
app/organization/media/urls.py
app/organization/media/views.py
app/organization/projects/migrations/0052_auto_20170314_1828.py [new file with mode: 0644]

index 7eb1695a5919014c00e972df87ce0eaa9c0be90b..759cbe6a06d15c9e27ba7cfc0c8c33a714d63c08 100644 (file)
@@ -35,7 +35,7 @@ class MediaImageInline(TabularDynamicInlineAdmin):
 
     model = MediaImage
 
-    
+
 class MediaAdmin(BaseTranslationModelAdmin):
 
     model = Media
@@ -60,10 +60,13 @@ class MediaCategoryAdmin(BaseTranslationModelAdmin):
     model = MediaCategory
 
 
+class LiveStreamingAdmin(BaseTranslationModelAdmin):
 
-
+    model = LiveStreaming
+    list_display = ['title',]
 
 
 admin.site.register(Media, MediaAdmin)
 admin.site.register(Playlist, PlaylistAdmin)
 admin.site.register(MediaCategory, MediaCategoryAdmin)
+admin.site.register(LiveStreaming, LiveStreamingAdmin)
diff --git a/app/organization/media/migrations/0014_livestreaming.py b/app/organization/media/migrations/0014_livestreaming.py
new file mode 100644 (file)
index 0000000..238adc4
--- /dev/null
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-03-14 17:28
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sites', '0002_alter_domain_unique'),
+        ('organization-media', '0013_mediaimage'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='LiveStreaming',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('keywords_string', models.CharField(blank=True, editable=False, max_length=500)),
+                ('title', models.CharField(max_length=500, verbose_name='Title')),
+                ('title_en', models.CharField(max_length=500, null=True, verbose_name='Title')),
+                ('title_fr', models.CharField(max_length=500, null=True, verbose_name='Title')),
+                ('slug', models.CharField(blank=True, help_text='Leave blank to have the URL auto-generated from the title.', max_length=2000, null=True, verbose_name='URL')),
+                ('_meta_title', models.CharField(blank=True, help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title')),
+                ('description', models.TextField(blank=True, verbose_name='Description')),
+                ('description_en', models.TextField(blank=True, null=True, verbose_name='Description')),
+                ('description_fr', models.TextField(blank=True, null=True, verbose_name='Description')),
+                ('gen_description', models.BooleanField(default=True, help_text='If checked, the description will be automatically generated from content. Uncheck if you want to manually set a custom description.', verbose_name='Generate description')),
+                ('created', models.DateTimeField(editable=False, null=True)),
+                ('updated', models.DateTimeField(editable=False, null=True)),
+                ('status', models.IntegerField(choices=[(1, 'Draft'), (2, 'Published')], default=2, help_text='With Draft chosen, will only be shown for admin users on the site.', verbose_name='Status')),
+                ('publish_date', models.DateTimeField(blank=True, db_index=True, help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from')),
+                ('expiry_date', models.DateTimeField(blank=True, help_text="With Published chosen, won't be shown after this time", null=True, verbose_name='Expires on')),
+                ('short_url', models.URLField(blank=True, null=True)),
+                ('in_sitemap', models.BooleanField(default=True, verbose_name='Show in sitemap')),
+                ('html5_url', models.URLField(blank=True, max_length=1024, verbose_name='html5 url')),
+                ('html5_url_en', models.URLField(blank=True, max_length=1024, null=True, verbose_name='html5 url')),
+                ('html5_url_fr', models.URLField(blank=True, max_length=1024, null=True, verbose_name='html5 url')),
+                ('youtube_id', models.CharField(blank=True, max_length=64, null=True, verbose_name='youtube id')),
+                ('type', models.CharField(choices=[('html5', 'html5'), ('youtube', 'youtube')], default='html5', max_length=32, verbose_name='type')),
+                ('site', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='sites.Site')),
+            ],
+            options={
+                'verbose_name': 'live streaming',
+                'verbose_name_plural': 'live streamings',
+            },
+        ),
+    ]
index 640d37962fe41d69c6c9be1a5776a1f134597d12..ffe4957111f892c45236eaff4159cf370c7eef63 100644 (file)
@@ -42,6 +42,12 @@ PLAYLIST_TYPE_CHOICES = [
     ('video', _('video')),
 ]
 
+LIVE_STREAMING_TYPE_CHOICES = [
+    ('html5', _('html5')),
+    ('youtube', _('youtube')),
+]
+
+
 class Media(Displayable):
     """Media"""
 
@@ -169,3 +175,21 @@ class PlaylistRelated(models.Model):
     class Meta:
         verbose_name = _('playlist')
         verbose_name_plural = _('playlists')
+
+
+class LiveStreaming(Displayable):
+    """Live streaming"""
+
+    html5_url = models.URLField(_('html5 url'), max_length=1024, blank=True)
+    youtube_id = models.CharField(_('youtube id'), max_length=64, blank=True, null=True)
+    type = models.CharField(_('type'), max_length=32, choices=LIVE_STREAMING_TYPE_CHOICES, default='html5')
+
+    class Meta:
+        verbose_name = "live streaming"
+        verbose_name_plural = "live streamings"
+
+    def __str__(self):
+        return self.title
+
+    def get_absolute_url(self):
+        return reverse("organization-streaming-detail", kwargs={"slug": self.slug})
index 3dc1ed9b93ef97244a37bc2f34b9dfd7bb5259cd..55f0bff2845e8153b32796da0ccd8a9d3b422026 100644 (file)
@@ -58,3 +58,9 @@ class MediaCategoryTranslationOptions(TranslationOptions):
 class MediaImageTranslationOptions(TranslationOptions):
 
     fields = ()
+
+
+@register(LiveStreaming)
+class LiveStreamingTranslationOptions(TranslationOptions):
+
+    fields = ('title', 'description', 'html5_url')
index 0cc5df193ae3905443f7dce4c0e1fa7e95d4dbe2..abdd7787de2b965a1bc67d166d670dcf841dfea0 100644 (file)
@@ -40,4 +40,5 @@ urlpatterns = [
     url("^playlists/list/(?P<type>.*)$", PlaylistListView.as_view(), name="organization-playlist-list"),
     url("^playlists/overlay/(?P<slug>.*)/$", PlaylistOverlayView.as_view(), name="organization-playlist-overlay"),
     url("^playlist-media-autocomplete/$",  permission_required('playlist.can_edit')(PlayListMediaView.as_view()), name='media-autocomplete'),
+    url("^streamings/(?P<slug>.*)/detail/$", LiveStreamingDetailView.as_view(), name="organization-streaming-detail"),
 ]
index f24ae5a45802c8c161c13fa42d233e2545387e77..8f89245c964aa1c0ff79837eb94b8a9713e75207 100644 (file)
@@ -111,6 +111,7 @@ class PlayListMediaView(autocomplete.Select2QuerySetView):
 
 
 class MediaOverlayView(SlugMixin, DetailView):
+
     model = Media
     template_name='media/media/media_overlay.html'
     context_object_name = 'media'
@@ -122,6 +123,13 @@ class MediaOverlayView(SlugMixin, DetailView):
 
 
 class PlaylistOverlayView(SlugMixin, DetailView):
+
     model = Playlist
     template_name='media/playlist_overlay.html'
     context_object_name = 'playlist'
+
+
+class LiveStreamingDetailView(SlugMixin, DetailView):
+
+    model = LiveStreaming
+    template_name='media/live_streaming_detail.html'
diff --git a/app/organization/projects/migrations/0052_auto_20170314_1828.py b/app/organization/projects/migrations/0052_auto_20170314_1828.py
new file mode 100644 (file)
index 0000000..9dcedf8
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-03-14 17:28
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-projects', '0051_auto_20170314_0937'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='projectpublicdata',
+            name='challenges_description',
+            field=models.TextField(help_text='Full description of the challenges faced by the project (100-150 words).', verbose_name='challenges description'),
+        ),
+        migrations.AlterField(
+            model_name='projectpublicdata',
+            name='objectives_description',
+            field=models.TextField(help_text='What the project is looking to gain from the collaboration and what kind of artist would be suitable (100 – 150 words).', verbose_name='objectives description'),
+        ),
+    ]