show all speakers of a presentation
This commit is contained in:
parent
6f172da50a
commit
c1ff1546fe
5 changed files with 34 additions and 26 deletions
|
@ -117,7 +117,7 @@ class Presentation(models.Model):
|
|||
description = MarkupField()
|
||||
abstract = MarkupField()
|
||||
speaker = models.ForeignKey("speakers.Speaker", related_name="presentations")
|
||||
additional_speakers = models.ManyToManyField("speakers.Speaker", blank=True)
|
||||
additional_speakers = models.ManyToManyField("speakers.Speaker", related_name="copresentations", blank=True)
|
||||
cancelled = models.BooleanField(default=False)
|
||||
proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")
|
||||
section = models.ForeignKey(Section, related_name="presentations")
|
||||
|
|
|
@ -42,3 +42,13 @@ class Speaker(models.Model):
|
|||
return self.user.email
|
||||
else:
|
||||
return self.invite_email
|
||||
|
||||
@property
|
||||
def all_presentations(self):
|
||||
presentations = []
|
||||
if self.presentations:
|
||||
for p in self.presentations.all():
|
||||
presentations.append(p)
|
||||
for p in self.copresentations.all():
|
||||
presentations.append(p)
|
||||
return presentations
|
||||
|
|
|
@ -126,10 +126,11 @@ def speaker_edit(request, pk=None):
|
|||
|
||||
def speaker_profile(request, pk):
|
||||
speaker = get_object_or_404(Speaker, pk=pk)
|
||||
|
||||
if not speaker.presentations and not request.user.is_staff:
|
||||
presentations = speaker.all_presentations
|
||||
if not presentations and not request.user.is_staff:
|
||||
raise Http404()
|
||||
|
||||
return render(request, "speakers/speaker_profile.html", {
|
||||
"speaker": speaker,
|
||||
"presentations": presentations,
|
||||
})
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
{% extends "site_base.html" %}
|
||||
|
||||
{% load sitetree %}
|
||||
|
||||
{% block head_title %}Presentation: {{ presentation.title }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<h1>{{ presentation.title }}</h1>
|
||||
{% block breadcrumbs %}{% sitetree_breadcrumbs from "main" %}{% endblock %}
|
||||
|
||||
<h2>
|
||||
{% block body %}
|
||||
{% if presentation.slot %}
|
||||
<h4>
|
||||
{{ presentation.slot.day.date|date:"l" }}
|
||||
{{ presentation.slot.start}}–{{ presentation.slot.end }}
|
||||
</h4>
|
||||
{% endif %}
|
||||
<h2>{{ presentation.title }}</h2>
|
||||
|
||||
<h4>
|
||||
{% for speaker in presentation.speakers %}
|
||||
<a href="{% url speaker_profile speaker.pk %}">{{ speaker }}</a>
|
||||
{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
</h2>
|
||||
|
||||
<a href="{% url speaker_profile speaker.pk %}">{{ speaker }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
</h4>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Audience level:</dt>
|
||||
<dd style="margin-bottom: 0;">{{ presentation.proposal.get_audience_level_display }}</dd>
|
||||
<dt>Track:</dt>
|
||||
<dd>{{ presentation.proposal.track }}</dd>
|
||||
</dl>
|
||||
|
||||
{% if presentation.slot %}
|
||||
<h2>
|
||||
{{ presentation.slot.day.date|date:"l" }}
|
||||
{{ presentation.slot.start}}–{{ presentation.slot.end }}
|
||||
in
|
||||
{{ presentation.slot.rooms|join:", " }}
|
||||
</h2>
|
||||
{% endif %}
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<div class="description">{{ presentation.description }}</div>
|
||||
|
||||
|
||||
<h3>Abstract</h3>
|
||||
|
||||
|
||||
<div class="abstract">{{ presentation.abstract|safe }}</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% load thumbnail %}
|
||||
|
||||
|
||||
{% block page_title %}{% endblock %}
|
||||
{% block head_title %}{{ speaker.name }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
|
@ -23,7 +23,7 @@
|
|||
<div class="bio">{{ speaker.biography|safe }}</div>
|
||||
|
||||
<h2>Presentations</h2>
|
||||
{% for presentation in speaker.presentations.all %}
|
||||
{% for presentation in presentations %}
|
||||
<h3><a href="{% url schedule_presentation_detail presentation.pk %}">{{ presentation.title }}</a></h3>
|
||||
{% if presentation.slot %}
|
||||
<p>
|
||||
|
|
Loading…
Reference in a new issue