This repository was archived by the owner on Apr 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
WIP list accepted talks/proposals #975
Open
artcz
wants to merge
1
commit into
ep2019
Choose a base branch
from
feature/list-accepted-proposals
base: ep2019
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -22,6 +21,59 @@ def talk(request, talk_slug): | |
) | ||
|
||
|
||
def list_accepted_talks_for_current_conference(request): | ||
""" | ||
""" | ||
# Copy from conference/talk_vorting.py; | ||
# Possibly could be refactored to use some function to come up with filters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 = { | ||
|
@@ -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"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.