talk: video field
This commit is contained in:
parent
cc900cdf4e
commit
9cec272090
|
@ -234,6 +234,16 @@ class Program:
|
|||
'max': talk.attendees_limit,
|
||||
'remain': talk.remaining_attendees or 0,
|
||||
}
|
||||
if talk.materials:
|
||||
links += mark_safe("""
|
||||
<link tag="slides">%(link)s</link>""" % {
|
||||
'link': talk.materials.url,
|
||||
})
|
||||
if talk.video:
|
||||
links += mark_safe("""
|
||||
<link tag="video">%(link)s</link>""" % {
|
||||
'link': talk.video,
|
||||
})
|
||||
days_xml += """ <event id="%(id)s">
|
||||
<start>%(start)s</start>
|
||||
<duration>%(duration)s</duration>
|
||||
|
|
|
@ -40,7 +40,7 @@ class TalkForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Talk
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'materials', 'duration', 'start_date', 'room', 'registration_required', 'attendees_limit']
|
||||
fields = ['title', 'abstract', 'description', 'topics', 'track', 'notes', 'event', 'speakers', 'materials', 'video', 'duration', 'start_date', 'room', 'registration_required', 'attendees_limit']
|
||||
widgets = {'topics': forms.CheckboxSelectMultiple(), 'speakers': Select2TagWidget()}
|
||||
help_texts = {
|
||||
'abstract': _('Should be less than 255 characters'),
|
||||
|
@ -73,6 +73,7 @@ class TalkFilterForm(forms.Form):
|
|||
room = forms.NullBooleanField(help_text=_('Filter talks already / not yet affected to a room'))
|
||||
scheduled = forms.NullBooleanField(help_text=_('Filter talks already / not yet scheduled'))
|
||||
materials = forms.NullBooleanField(help_text=_('Filter talks with / without materials'))
|
||||
video = forms.NullBooleanField(help_text=_('Filter talks with / without video'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
site = kwargs.pop('site')
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-01-16 21:47
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('proposals', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='talk',
|
||||
name='video',
|
||||
field=models.URLField(blank=True, default='', max_length=1000, verbose_name='URL vidéo'),
|
||||
),
|
||||
]
|
|
@ -170,6 +170,7 @@ class Talk(PonyConfModel):
|
|||
attendees_limit = models.PositiveIntegerField(default=0, verbose_name=_('Max. number of attendees'))
|
||||
materials = models.FileField(null=True, upload_to=talk_materials_destination, verbose_name=_('Materials'),
|
||||
help_text=_('You can use this field to share some materials related to your intervention.'))
|
||||
video = models.URLField(max_length=1000, blank=True, default='', verbose_name='URL vidéo')
|
||||
|
||||
class Meta:
|
||||
ordering = ('title',)
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
<dt>{% trans "Materials" %}</dt>
|
||||
<dd><a href="{{ talk.materials.url }}">{{ talk.materials_name }}</a></dd>
|
||||
{% endif %}
|
||||
{% if talk.video %}
|
||||
<dt>{% trans "Video" %}</dt>
|
||||
<dd><a href="{{ talk.video }}">{% trans "download" %}</a></dd>
|
||||
{% endif %}
|
||||
|
||||
</dl>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
{% bootstrap_field filter_form.room layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.scheduled layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.materials layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.video layout="horizontal" %}
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-6">
|
||||
{% bootstrap_field filter_form.topic layout="horizontal" %}
|
||||
|
|
|
@ -98,16 +98,26 @@ def talk_list(request):
|
|||
q |= Q(track__slug__in=data['track'])
|
||||
talks = talks.filter(q)
|
||||
if data['vote'] != None:
|
||||
show_filters = True
|
||||
if data['vote']:
|
||||
talks = talks.filter(vote__user=request.user)
|
||||
else:
|
||||
talks = talks.exclude(vote__user=request.user)
|
||||
if data['room'] != None:
|
||||
show_filters = True
|
||||
talks = talks.filter(room__isnull=not data['room'])
|
||||
if data['scheduled'] != None:
|
||||
show_filters = True
|
||||
talks = talks.filter(start_date__isnull=not data['scheduled'])
|
||||
if data['materials'] != None:
|
||||
show_filters = True
|
||||
talks = talks.filter(materials__isnull=not data['materials'])
|
||||
if data['video'] != None:
|
||||
show_filters = True
|
||||
if data['video']:
|
||||
talks = talks.exclude(video__exact='')
|
||||
else:
|
||||
talks = talks.filter(video__exact='')
|
||||
# Action
|
||||
action_form = TalkActionForm(request.POST or None, talks=talks, site=get_current_site(request))
|
||||
if not is_orga(request, request.user):
|
||||
|
@ -205,6 +215,7 @@ def talk_edit(request, talk=None):
|
|||
talk.room.capacity) % {'room': talk.room.name, 'capacity': talk.room.capacity}
|
||||
else:
|
||||
form.fields.pop('materials')
|
||||
form.fields.pop('video')
|
||||
form.fields['speakers'].initial = [request.user]
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
if hasattr(talk, 'id'):
|
||||
|
|
Loading…
Reference in New Issue