Added some documentation.
This commit is contained in:
@ -6,7 +6,8 @@ from django_tables2.utils import A # alias for Accessor
|
||||
class SpeakerTable(tables.Table):
|
||||
"""
|
||||
Configures the table showing all speakers. Inserts a column with links to
|
||||
the profile of one speaker. Also defines all shown columns.
|
||||
the profile of one speaker. Also defines all shown columns. The template
|
||||
speakers/table.html is imported in line 19.
|
||||
"""
|
||||
link = tables.LinkColumn("MdB", text="Profil", args=[A("id")],
|
||||
orderable=False,
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template creates the profile page for one speaker. -->
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -1,6 +1,9 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template creates the searchable list of all speakers MdBs of the
|
||||
Bundestag since 1949. -->
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -1,5 +1,9 @@
|
||||
{% load django_tables2 %}
|
||||
{% load i18n %}
|
||||
|
||||
<!-- This template creates a table template which is used by the different table
|
||||
classes defined in tables.py. Mostly used to display search results. -->
|
||||
|
||||
{% block table-wrapper %}
|
||||
{% block table %}
|
||||
<table {% render_attrs table.attrs %} class="highlight">
|
||||
|
@ -1,6 +1,10 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
"""
|
||||
Url paths for all speakers views.
|
||||
"""
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.speakers, name="MdBs"),
|
||||
path("mdb/<int:id>", views.speaker, name="MdB"),
|
||||
|
@ -11,6 +11,9 @@ from speeches.forms import SearchFormSpeech
|
||||
|
||||
|
||||
def speakers(request):
|
||||
"""
|
||||
This view creates the page for the searchable speakers list.
|
||||
"""
|
||||
if(request.method == "GET"):
|
||||
form = SearchForm(request.GET)
|
||||
if(form.is_valid()):
|
||||
@ -30,6 +33,9 @@ def speakers(request):
|
||||
|
||||
|
||||
def speaker(request, id):
|
||||
"""
|
||||
This view creates the profile page of one speaker.
|
||||
"""
|
||||
try:
|
||||
current_speaker = Speaker.objects.get(pk=id)
|
||||
speech_count = len(Speech.objects.filter(foreign_speaker=id))
|
||||
|
Reference in New Issue
Block a user