Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

WIP list accepted talks/proposals #975

Open
wants to merge 1 commit into
base: ep2019
Choose a base branch
from
Open
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
65 changes: 60 additions & 5 deletions conference/talks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required
from django.conf import settings
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse

from conference.models import Talk
from conference.models import Talk, TALK_STATUS, TALK_TYPE_CHOICES


# Temporary
@staff_member_required
def talk(request, talk_slug):
"""
Display Talk
Expand All @@ -22,6 +21,59 @@ def talk(request, talk_slug):
)


def list_accepted_talks_for_current_conference(request):
"""
"""
# Copy from conference/talk_vorting.py;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copy from conference/talk_vorting.py;
# Copy from conference/talk_voting.py;

# Possibly could be refactored to use some function to come up with filters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have the same code in two files, this is definitely a candidate to be refactored.

talk_type = request.GET.get("talk_type", "all")
extra_filters = []
if talk_type == "talk":
extra_filters += [
Q(
type__in=[
TALK_TYPE_CHOICES.t_30,
TALK_TYPE_CHOICES.t_45,
TALK_TYPE_CHOICES.t_60,
]
)
]
if talk_type == "training":
extra_filters += [Q(type__in=[TALK_TYPE_CHOICES.r_180])]
if talk_type == "poster":
extra_filters += [
Q(
type__in=[
TALK_TYPE_CHOICES.i_60,
TALK_TYPE_CHOICES.p_180,
TALK_TYPE_CHOICES.n_60,
TALK_TYPE_CHOICES.n_90,
]
)
]
if talk_type == "helpdesk":
extra_filters += [Q(type__in=[TALK_TYPE_CHOICES.h_180])]

talks = get_accepted_talks_for_current_conference(extra_filters)

return TemplateResponse(
request,
"ep19/bs/talks/list_accepted_talks.html",
{"talks": talks, "talk_type": talk_type}
)


def get_accepted_talks_for_current_conference(extra_filters):
return (
Talk.objects
.filter(
conference=settings.CONFERENCE_CONFERENCE,
status=TALK_STATUS.accepted
)
.filter(*extra_filters)
)


def dump_relevant_talk_information_to_dict(talk: Talk):

output = {
Expand Down Expand Up @@ -61,4 +113,7 @@ def dump_relevant_talk_information_to_dict(talk: Talk):
return output


urlpatterns = [url(r"^(?P<talk_slug>[\w-]+)/$", talk, name="talk")]
urlpatterns = [
url(r"^$", list_accepted_talks_for_current_conference, name="list"),
url(r"^(?P<talk_slug>[\w-]+)/$", talk, name="talk"),
]
63 changes: 63 additions & 0 deletions templates/ep19/bs/talks/list_accepted_talks.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% extends "ep19/bs/base.html" %}

{% block content %}
<style type="text/css">
.talk {
padding: 1.5em 0;
border-top: 1px dotted #ddd;
border-bottom: 1px dotted #ddd;
}
</style>

<div class="container page" id="voting_page">
<div class="row">
<div class="col-md-12">
<h1>List of accepted proposals for EP2019</h1>
<h4>Proposal type
<a class='btn btn-{% if talk_type != "all" %}outline-{% endif %}success'
href="{% url 'talks:list' %}?talk_type=all&filter={{ filter }}"
>
All
</a>
<a class='btn btn-{% if talk_type != "talk" %}outline-{% endif %}success'
href="{% url 'talks:list' %}?talk_type=talk&filter={{ filter }}"
>
Talk
</a>
<a class='btn btn-{% if talk_type != "training" %}outline-{% endif %}success'
href="{% url 'talks:list' %}?talk_type=training&filter={{ filter }}"
>
Training
</a>
<a class='btn btn-{% if talk_type != "poster" %}outline-{% endif %}success'
href="{% url 'talks:list' %}?talk_type=poster&filter={{ filter }}"
>
Poster/Panel/Interactive
</a>
<a class='btn btn-{% if talk_type != "helpdesk" %}outline-{% endif %}success'
href="{% url 'talks:list' %}?talk_type=helpdesk&filter={{ filter }}"
>
Help desk
</a>
</h4>
</div>
</div>

<div class='row'>
<div class="col-md-12">
{% for talk in talks %}
<div class='talk'>
<h2>{{ talk.title }}</h2>
<h4>{{ talk.sub_title }}</h4>
<h5>{% for speaker in talk.get_all_speakers %}{{ speaker.user.assopy_user.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</h5>
<p>{% for t in talk.tags.all %}<span class='badge badge-secondary'>{{ t }}</span> {% endfor %}</p>
{# <p>{{ talk.get_abstract|linebreaks }}</p> #}
<p>
<code>Type: {{ talk.get_type_display }}; Python level: {{ talk.get_level_display }}; Domain level: {{ talk.get_domain_level_display }}</code>
</p>
</div>
{% endfor %}{# talk in talks #}
</div>
</div>
</div>
{% endblock %}