Cleanup speaker display when no title is given

This commit is contained in:
Michael Hall 2018-09-21 00:26:33 -04:00
parent 3e0ba04aea
commit 9170eee9a9
4 changed files with 14 additions and 8 deletions

View file

@ -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)

View file

@ -207,7 +207,7 @@ textarea {
<div class="col-3" width="120px"><b>Presentations:</b></div>
<div class="col-9">
{% for presentation in presentation_list %}
<div><a href="{% url 'show-talk' presentation.talk.id %}">{{presentation.talk.title}}</a> by <a href="{% url 'show-speaker' presentation.talk.speaker.id %}">{{presentation.talk.speaker.user}}, {{presentation.talk.speaker.title}}</a></div>
<div><a href="{% url 'show-talk' presentation.talk.id %}">{{presentation.talk.title}}</a> by <a href="{% url 'show-speaker' presentation.talk.speaker.id %}">{{presentation.talk.speaker}}</a></div>
{% endfor %}
{% if not event.is_over %}
<a class="btn btn-primary btn-sm" href="{% url 'propose-event-talk' event.id %}">Propose a talk</a>

View file

@ -10,9 +10,13 @@
<div class="container">
<div class="row">
<div class="col-md-9">
<img src="{{speaker.headshot_url}}"/><hr/>
<img src="{{speaker.headshot_url}}"/>
{% if speaker.user == request.user.profile %}
<a href="{% url 'edit-speaker' speaker.id %}" class="btn btn-secondary btn-sm">Edit Bio</a>
{% endif %}
<hr/>
<h3>{{ speaker.user }}</h3>
<h5 class="text-muted">{{ speaker.title }}</h5>
{% if speaker.title %}<h5 class="text-muted">{{ speaker.title }}</h5>{% endif %}
<p>
{{ speaker.bio|markdown }}
</p>

View file

@ -12,7 +12,7 @@
</h2>
<table class="table">
<tr>
<td><b>Speaker:</b></td><td><a href="{% url 'show-speaker' talk.speaker.id %}">{{ talk.speaker.user }}, {{ talk.speaker.title }}</a></td>
<td><b>Speaker:</b></td><td><a href="{% url 'show-speaker' talk.speaker.id %}">{{ talk.speaker }}</a></td>
</tr>
<tr>
<td><b>Category:</b></td><td>{{ talk.category }}</td>