From 9170eee9a9c738a4a17523e51d7568c2a08b6099 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Fri, 21 Sep 2018 00:26:33 -0400 Subject: [PATCH] Cleanup speaker display when no title is given --- events/models/speakers.py | 10 ++++++---- .../templates/get_together/events/show_event.html | 2 +- .../templates/get_together/speakers/show_speaker.html | 8 ++++++-- .../templates/get_together/speakers/show_talk.html | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/events/models/speakers.py b/events/models/speakers.py index 1b89944..20391ff 100644 --- a/events/models/speakers.py +++ b/events/models/speakers.py @@ -42,9 +42,10 @@ class Speaker(models.Model): def __str__(self): - if self.title: - return self.title - return self.user.__str__() + if self.title is not None and self.title != '': + return '%s, %s' % (self.user, self.title) + else: + return str(self.user) class Talk(models.Model): PRESENTATION=0 @@ -79,7 +80,8 @@ class Talk(models.Model): return self.presentations.filter(status=1, event__start_time__lte=timezone.now()) def __str__(self): - return self.title + self.title + class SpeakerRequest(models.Model): event = models.ForeignKey(Event, on_delete=models.CASCADE) diff --git a/get_together/templates/get_together/events/show_event.html b/get_together/templates/get_together/events/show_event.html index a1511fa..ed528e6 100644 --- a/get_together/templates/get_together/events/show_event.html +++ b/get_together/templates/get_together/events/show_event.html @@ -207,7 +207,7 @@ textarea {
Presentations:
{% for presentation in presentation_list %} -
{{presentation.talk.title}} by {{presentation.talk.speaker.user}}, {{presentation.talk.speaker.title}}
+
{{presentation.talk.title}} by {{presentation.talk.speaker}}
{% endfor %} {% if not event.is_over %} Propose a talk diff --git a/get_together/templates/get_together/speakers/show_speaker.html b/get_together/templates/get_together/speakers/show_speaker.html index 1aecc2c..43d7bd2 100644 --- a/get_together/templates/get_together/speakers/show_speaker.html +++ b/get_together/templates/get_together/speakers/show_speaker.html @@ -10,9 +10,13 @@
-
+ + {% if speaker.user == request.user.profile %} + Edit Bio + {% endif %} +

{{ speaker.user }}

-
{{ speaker.title }}
+ {% if speaker.title %}
{{ speaker.title }}
{% endif %}

{{ speaker.bio|markdown }}

diff --git a/get_together/templates/get_together/speakers/show_talk.html b/get_together/templates/get_together/speakers/show_talk.html index bfe0f66..5e259b2 100644 --- a/get_together/templates/get_together/speakers/show_talk.html +++ b/get_together/templates/get_together/speakers/show_talk.html @@ -12,7 +12,7 @@ - +
Speaker:{{ talk.speaker.user }}, {{ talk.speaker.title }}Speaker:{{ talk.speaker }}
Category:{{ talk.category }}