implemented speaker profiles
This commit is contained in:
parent
5944bb5577
commit
9e794bd66a
3 changed files with 66 additions and 17 deletions
|
@ -98,24 +98,12 @@ def speaker_edit(request, pk=None):
|
|||
})
|
||||
|
||||
|
||||
def speaker_profile(request, pk, template_name="speakers/speaker_profile.html", extra_context=None):
|
||||
|
||||
if extra_context is None:
|
||||
extra_context = {}
|
||||
|
||||
def speaker_profile(request, pk):
|
||||
speaker = get_object_or_404(Speaker, pk=pk)
|
||||
|
||||
# schedule may not be installed so we need to check for sessions
|
||||
if hasattr(speaker, "sessions"):
|
||||
sessions = speaker.sessions.exclude(slot=None).order_by("slot__start")
|
||||
else:
|
||||
sessions = []
|
||||
|
||||
if not sessions:
|
||||
if not speaker.presentations and not request.user.is_staff:
|
||||
raise Http404()
|
||||
|
||||
return render_to_response(template_name, dict({
|
||||
return render(request, "speakers/speaker_profile.html", {
|
||||
"speaker": speaker,
|
||||
"sessions": sessions,
|
||||
"timezone": settings.SCHEDULE_TIMEZONE,
|
||||
}, **extra_context), context_instance=RequestContext(request))
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<h2>
|
||||
{% for speaker in presentation.speakers %}
|
||||
{{ speaker }}
|
||||
<a href="{% url speaker_profile speaker.pk %}">{{ speaker }}</a>
|
||||
{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
</h2>
|
||||
|
||||
|
|
61
symposion/templates/speakers/speaker_profile.html
Normal file
61
symposion/templates/speakers/speaker_profile.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
{% extends "site_base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load thumbnail %}
|
||||
|
||||
|
||||
{% block page_title %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
{% if speaker.photo %}
|
||||
<img src="{% thumbnail speaker.photo '128x128' %}" alt="{{ speaker.name }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="span6">
|
||||
{% if speaker.user == request.user or request.user.is_staff %}
|
||||
<a class="btn pull-right" href="{% url speaker_edit speaker.pk %}">Edit</a>
|
||||
{% endif %}
|
||||
<h1>{{ speaker.name }}</h1>
|
||||
<div class="bio">{{ speaker.biography|safe }}</div>
|
||||
|
||||
<h2>Presentations</h2>
|
||||
{% for presentation in speaker.presentations.all %}
|
||||
<h3><a href="{% url schedule_presentation_detail presentation.pk %}">{{ presentation.title }}</a></h3>
|
||||
{% if presentation.slot %}
|
||||
<p>
|
||||
{{ presentation.slot.day.date|date:"l" }}
|
||||
{{ presentation.slot.start}}–{{ presentation.slot.end }}
|
||||
in
|
||||
{{ presentation.slot.rooms|join:", " }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
<p>No presentations. This page is only visible to staff until there is a presentation.<p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% comment %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if sessions %}
|
||||
<h3>Presentations</h3>
|
||||
|
||||
<dl class="sessions">
|
||||
{% for session in sessions %}
|
||||
<dt>{{ session.slot.start|localtime:timezone|date:"F jS" }} {{ session.slot.start|localtime:timezone|date:"P" }} – {{ session.slot.end|localtime:timezone|date:"P" }}</dt>
|
||||
<dd><a href="{% url schedule_presentation session.id %}">{{ session.title }}</a></dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% endcomment %}
|
Loading…
Reference in a new issue