Add show-speaker page

This commit is contained in:
Michael Hall 2018-04-27 22:49:56 -04:00
parent a81c9fddf7
commit fa4c0fd132
6 changed files with 79 additions and 2 deletions

View file

@ -13,6 +13,9 @@
</div>
{% endif %}
<div class="container">
<h2>Manage talks for: {{event.name}}</h2>
{% if pending_talks %}
<hr/>
<div class="row">
{% for presentation in pending_talks %}
<form action="{% url 'schedule-event-talks' event.id %}" method="POST">
@ -35,6 +38,7 @@
</form>
{% endfor %}
</div>
{% endif %}
{% if accepted_talks %}
<hr/>
<div class="row">

View file

@ -152,7 +152,7 @@
<td width="120px"><b>Presentations:</b></td>
<td>
{% for presentation in presentation_list %}
<div><a href="{% url 'show-talk' presentation.talk.id %}">{{presentation.talk.title}}</a> by <a href="{% url 'show-profile' presentation.talk.speaker.user.id %}">{{presentation.talk.speaker.user}}</a>, {{presentation.talk.speaker.title}}</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.user}}, {{presentation.talk.speaker.title}}</a></div>
{% endfor %}
<a class="btn btn-primary btn-sm" href="{% url 'propose-event-talk' event.id %}">Propose a talk</a>
{% if pending_presentations %}

View file

@ -0,0 +1,61 @@
{% extends "get_together/base.html" %}
{% load markup static %}
{% block styles %}
<link href="{% static 'css/bootstrap-album.css' %}" rel="stylesheet"/>
{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-9">
<img src="{{speaker.headshot.url}}"/><hr/>
<h3>{{ speaker.user }}</h3>
<h5 class="text-muted">{{ speaker.title }}</h5>
<p>
{{ speaker.bio|markdown }}
</p>
{% if talks %}
<br/>
<h4>Talks</h4>
<div class="container">
<div class="row">
{% for talk in talks %}
<div class="col-md-4">
<div class="card box-shadow" >
<div class="card-body">
<p class="card-title"><strong><a href="{% url 'show-talk' talk.id %}">{{talk.title}}</a></strong></p>
<div class="card-text">
<small class="text-muted mb-1">{{ talk.speaker }}</small>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<div class="col-md-3">
<div class="container">
<div class="row">
<div class="col"><h4>Events ({{presentations.count}})</h4><hr/></div>
</div>
{% for presentation in presentations %}
<div class="row mb-3">
<div class="col">
<h6 class="mt-2 mb-0"><a href="{{presentation.event.get_absolute_url}}">{{presentation.event.name}}</a></h6>
<small>{{ presentation.event.team }}</small><br/>
<small class="text-muted">{{ presentation.event.local_start_time }}</small>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -12,7 +12,7 @@
</h2>
<table class="table">
<tr>
<td><b>Speaker:</b></td><td>{{ talk.speaker }}</td>
<td><b>Speaker:</b></td><td><a href="{% url 'show-speaker' talk.speaker.id %}">{{ talk.speaker.user }}, {{ talk.speaker.title }}</a></td>
</tr>
<tr>
<td><b>Category:</b></td><td>{{ talk.category }}</td>
@ -38,6 +38,7 @@
<div class="row mb-3">
<div class="col">
<h6 class="mt-2 mb-0"><a href="{{presentation.event.get_absolute_url}}">{{presentation.event.name}}</a></h6>
<small>{{ presentation.event.team }}</small><br/>
<small class="text-muted">{{ presentation.event.local_start_time }}</small>
</div>
</div>

View file

@ -50,6 +50,7 @@ urlpatterns = [
path('profile/<str:account_secret>.ics', feeds.UserEventsCalendar(), name='user-event-ical'),
path('profile/+add-speaker', views.add_speaker, name='add-speaker'),
path('speaker/<int:speaker_id>/', views.show_speaker, name='show-speaker'),
path('speaker/<int:speaker_id>/+edit', views.edit_speaker, name='edit-speaker'),
path('speaker/<int:speaker_id>/+delete', views.delete_speaker, name='delete-speaker'),

View file

@ -34,6 +34,16 @@ def list_user_talks(request):
}
return render(request, 'get_together/speakers/list_user_talks.html', context)
def show_speaker(request, speaker_id):
speaker = get_object_or_404(Speaker, id=speaker_id)
context = {
'speaker': speaker,
'talks': Talk.objects.filter(speaker=speaker),
'presentations': Presentation.objects.filter(talk__speaker=speaker, status=Presentation.ACCEPTED),
}
return render(request, 'get_together/speakers/show_speaker.html', context)
def add_speaker(request):
new_speaker = Speaker(user=request.user.profile)
if request.method == 'GET':