Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speakers list page #74

Merged
merged 3 commits into from
May 24, 2017
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ ENV/
.ropeproject

dev.db

pybay/site_media/*
7 changes: 7 additions & 0 deletions pybay/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.conf import settings


def settings_variables(request):
return {
'SHOW_SPEAKERS_LIST_NAVBAR_LINK': getattr(settings, 'SHOW_SPEAKERS_LIST_NAVBAR_LINK', False)
}
9 changes: 7 additions & 2 deletions pybay/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
'django.contrib.messages.context_processors.messages',
'account.context_processors.account',
'pinax_theme_bootstrap.context_processors.theme',
'symposion.reviews.context_processors.reviews']}}]
'symposion.reviews.context_processors.reviews',
'pybay.context_processors.settings_variables',
]}
}]

MIDDLEWARE_CLASSES = [
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down Expand Up @@ -217,4 +220,6 @@
"talk": "pybay.proposals.forms.TalkProposalForm",
}
#Crispy Forms
CRISPY_TEMPLATE_PACK ='bootstrap3'
CRISPY_TEMPLATE_PACK = 'bootstrap3'

SHOW_SPEAKERS_LIST_NAVBAR_LINK = True
7 changes: 6 additions & 1 deletion pybay/templates/frontend/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@
<a class="inner-link" href="{% url 'pybay_sponsors' %}" >sponsors</a>
</li>
<li>
<a class="inner-link" href="/cfp">call for proposals</a>
<a class="inner-link" href="/cfp">Call For Proposals</a>
</li>
{% if SHOW_SPEAKERS_LIST_NAVBAR_LINK %}
<li>
<a class="inner-link" href="{% url 'pybay_speakers_list' %}">Speakers</a>
</li>
{% endif %}
<li>
<a class="inner-link" href="{% url 'pybay_tickets' %}">Registration</a>
</li>
Expand Down
23 changes: 23 additions & 0 deletions pybay/templates/frontend/speakers_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'frontend/base.html' %}
{% load static %}
{% load thumbnail %}

{% block content %}
<section>
<div class="container">
<div class="col-md-12 no-padding clearfix">
<div class="page-header pull-left">
<h1>All Speakers</h1>
</div>
</div><!-- /.col-md-12 -->

{% for speaker in speakers %}
<div class="col-md-6">
<img src="{% thumbnail speaker.photo '300x300' %}" alt="{{ speaker.name }}">
<h2>{{ speaker.name }}</h2>
<span>{{ speaker.biography|truncatechars:"300" }}</span>
</div>
{% endfor %}
</div><!--container -->
</section>
{% endblock content %}
Empty file added pybay/tests/__init__.py
Empty file.
5 changes: 2 additions & 3 deletions pybay/tests.py → pybay/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
from pybay.forms import CallForProposalForm



class CfpFormTestCase(TestCase):
fixtures=[
fixtures = [
"conference",
"proposal_base",
]

def _get_data(self):
return {
'first_name': "Daniel",
Expand Down
5 changes: 4 additions & 1 deletion pybay/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from symposion.sponsorship import urls as sponsor_urls
from symposion.speakers import urls as speaker_urls

from pybay.views import pybay_cfp_create, pybay_sponsors_list, pybay_faq_index
from pybay.views import (
pybay_cfp_create, pybay_sponsors_list,
pybay_faq_index, pybay_speakers_list)


WIKI_SLUG = r"(([\w-]{2,})(/[\w-]{2,})*)"
Expand Down Expand Up @@ -45,6 +47,7 @@
# url(r"^teams/", include("symposion.teams.urls")),
# url(r"^markitup/", include("markitup.urls")),
url(r"^our-sponsors$", pybay_sponsors_list, name="pybay_sponsors_list"),
url(r"^our-speakers$", pybay_speakers_list, name="pybay_speakers_list"),
# url(r"^", include("symposion.cms.urls")),
]

Expand Down
17 changes: 17 additions & 0 deletions pybay/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .forms import CallForProposalForm
from pybay.faqs.models import Faq
from symposion.sponsorship.models import Sponsor
from pybay.proposals.models import Proposal

from collections import defaultdict

Expand Down Expand Up @@ -44,3 +45,19 @@ def pybay_cfp_create(request):
else:
form = CallForProposalForm()
return render(request, 'frontend/cfp.html', {'form': form})


def pybay_speakers_list(request):
accepted_proposals = Proposal.objects.filter(
result__status='accepted')
speakers = []
for proposal in accepted_proposals:
speakers += list(proposal.speakers())
Copy link

Choose a reason for hiding this comment

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

This can lead to duplicate speakers

Copy link

Choose a reason for hiding this comment

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

oh sorry! didn't see above :)


speakers = list(set(speakers)) # filters duplicate speakers
speakers = filter(lambda s: s.photo, speakers) # filters speakers without photo
speakers = sorted(speakers, key=lambda i: i.name) # sorts alphabetically

return render(request, 'frontend/speakers_list.html', {
'speakers': speakers
})
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Django==1.9.2
django-appconf==1.0.1
django-bootstrap-form==3.2.1
django-crispy-forms==1.6.1
django-jsonfield==1.0.1
django-markitup==2.2.2
django-model-utils==2.4
Expand All @@ -10,16 +10,16 @@ django-taggit==0.18.0
django-timezone-field==2.0
django-timezones==0.2
django-user-accounts==2.0
Django==1.9.2
easy-thumbnails==2.3
eventlog==0.8.0
git+https://github.com/pybay/symposion.git#egg=symposion-1.0b2.dev3
html5lib==0.9999999
Markdown==2.6.5
metron==1.3.5
olefile==0.44
git+https://github.com/pybay/symposion.git#egg=symposion-1.0b2.dev3
Pillow
pinax-boxes==2.1.2
pinax-theme-bootstrap==5.6.0
pytz==2015.7
six==1.10.0
pinax-boxes==2.1.2
django-crispy-forms==1.6.1