Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions conference/forms/talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ def save(self, user):


class TalkSlidesForm(forms.ModelForm):
slides = forms.FileField(required=True)

class Meta:
model = Talk
fields = [
"slides"
"slides", "slides_url", "repository_url"
]


Expand Down
28 changes: 28 additions & 0 deletions conference/migrations/0015_add_talk_url_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-08-08 17:55
from __future__ import unicode_literals

import conference.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('conference', '0014_stripe_charge_default_uuid'),
]

operations = [
migrations.AddField(
model_name='talk',
name='repository_url',
field=models.URLField(blank=True),
),
migrations.AddField(
model_name='talk',
name='slides_url',
field=models.URLField(blank=True),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class Migration(migrations.Migration):

dependencies = [
('conference', '0014_stripe_charge_default_uuid'),
('conference', '0015_add_talk_url_fields'),
]

operations = [
Expand Down
2 changes: 2 additions & 0 deletions conference/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@ class Talk(models.Model, UrlMixin):
)

slides = models.FileField(upload_to=_fs_upload_to("slides"), blank=True)
slides_url = models.URLField(blank=True)
repository_url = models.URLField(blank=True)
video_type = models.CharField(
max_length=30, choices=VIDEO_TYPE, blank=True
)
Expand Down
3 changes: 2 additions & 1 deletion conference/talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def dump_relevant_talk_information_to_dict(talk: Talk):
"tags": [t.name for t in talk.tags.all()],
"speakers": [],
"schedule_url": talk.get_schedule_url(),
"slides_url": talk.slides,
"slides_file_url": talk.slides,
"slides_remote_url": talk.slides_url,
}

for speaker in talk.get_all_speakers():
Expand Down
2 changes: 1 addition & 1 deletion p3/management/commands/video_schedule_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
LICENSE = """

License: This video is licensed under the CC BY-NC-SA 3.0 license: https://creativecommons.org/licenses/by-nc-sa/3.0/
Please see our speaker release agreement for details: https://ep2018.europython.eu/en/speaker-release-agreement/
Please see our speaker release agreement for details: https://ep2019.europython.eu/events/speaker-release-agreement/
"""

# Special handling of poster sessions
Expand Down
7 changes: 5 additions & 2 deletions templates/ep19/bs/talks/talk.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ <h5>{% for speaker in talk_as_dict.speakers %}
{% if talk_as_dict.schedule_url %}
<a class="btn btn-primary" href="{{ talk_as_dict.schedule_url }}">See in schedule</a>
{% endif %}
{% if talk_as_dict.slides_url %}
<a class="btn btn-primary" href="{% get_media_prefix %}{{ talk_as_dict.slides_url }}">Slides</a>
{% if talk_as_dict.slides_file_url %}
<a class="btn btn-primary" href="{% get_media_prefix %}{{ talk_as_dict.slides_file_url }}">Download Slides</a>
{% endif %}
{% if talk_as_dict.slides_remote_url %}
<a class="btn btn-primary" href="{% get_media_prefix %}{{ talk_as_dict.slides_remote_url }}">View Slides</a>
{% endif %}
<p>{{ talk_as_dict.abstract|urlize|linebreaks }}</p>
<p>
Expand Down
57 changes: 52 additions & 5 deletions tests/test_talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,31 @@ def test_author_can_post_submit_slides(user_client):
talk.refresh_from_db()
assert talk.slides

def test_author_can_post_submit_slides_url(user_client):
setup_conference_with_typical_fares()
talk = TalkFactory(created_by=user_client.user, status=TALK_STATUS.accepted)

url = reverse("talks:submit_slides", args=[talk.slug])
payload = {"slides_url": "https://ep2019.europython.eu"}
response = user_client.post(url, data=payload)

assert redirects_to(response, talk.get_absolute_url())
talk.refresh_from_db()
assert talk.slides_url


def test_author_can_post_submit_repository_url(user_client):
setup_conference_with_typical_fares()
talk = TalkFactory(created_by=user_client.user, status=TALK_STATUS.accepted)

url = reverse("talks:submit_slides", args=[talk.slug])
payload = {"repository_url": "https://ep2019.europython.eu"}
response = user_client.post(url, data=payload)

assert redirects_to(response, talk.get_absolute_url())
talk.refresh_from_db()
assert talk.repository_url


def test_submit_slides_url_on_talk_detail_page(client):
"""
Expand Down Expand Up @@ -214,9 +239,9 @@ def test_submit_slides_url_on_talk_detail_page(client):
assert submit_slides_url in response.content.decode()


def test_view_slides_url_on_talk_detail_page(client):
def test_view_slides_file_url_on_talk_detail_page(client):
"""
The view slides button only appears if the slides have been uploaded.
The download slides button only appears if the slides have been uploaded.
"""
setup_conference_with_typical_fares()
talk = TalkFactory(status=TALK_STATUS.accepted)
Expand All @@ -226,13 +251,35 @@ def test_view_slides_url_on_talk_detail_page(client):
response = client.get(url)

assert not talk.slides
assert 'slides' not in response.content.decode()
assert 'download slides' not in response.content.decode().lower()

# Slides URL does appear when the slides have been uploaded
talk.slides = SimpleUploadedFile('slides.pdf', 'pdf content'.encode())
talk.save()

response = client.get(url)

assert talk.slides
assert 'slides' in response.content.decode()
assert 'download slides' in response.content.decode().lower()


def test_view_slides_remote_url_on_talk_detail_page(client):
"""
The view slides button only appears if the slides url has been uploaded.
"""
setup_conference_with_typical_fares()
talk = TalkFactory(status=TALK_STATUS.accepted)
url = talk.get_absolute_url()

# Slides URL does not appear when the slides haven't been uploaded
response = client.get(url)

assert not talk.slides_url
assert 'view slides' not in response.content.decode().lower()

# Slides URL does appear when the slides have been uploaded
talk.slides_url = "ep2019.europython.eu"
talk.save()

response = client.get(url)

assert 'view slides' in response.content.decode().lower()