Added some documentation.
This commit is contained in:
@ -13,8 +13,8 @@ class Command(BaseCommand):
|
||||
" syntax. Protocols will be added from the xml protocol files."
|
||||
" Input is a path pointing to all/multiple protocols in one"
|
||||
" directory with one level of subdirectories. First imports"
|
||||
" toc, attachments and metadata with model Protocol. Speeches will be put into realtion with the model Speech."
|
||||
" to the protocols later on.")
|
||||
" toc, attachments and metadata with model Protocol. Speeches will"
|
||||
" be put into realtion with the model Speech.")
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("input_path",
|
||||
|
@ -6,7 +6,8 @@ from django_tables2.utils import A # alias for Accessor
|
||||
class SpeechTable(tables.Table):
|
||||
"""
|
||||
Configures the table showing all speeches. Inserts a column with links to
|
||||
the speeches. Also defines all shown columns.
|
||||
the speeches. Also defines all shown columns. The template
|
||||
speeches/table.html is imported in line 21.
|
||||
"""
|
||||
link = tables.LinkColumn("Rede", text="Rede", args=[A("speech_id")],
|
||||
orderable=False,
|
||||
@ -25,6 +26,8 @@ class SpeakerSpeechTable(tables.Table):
|
||||
"""
|
||||
Configures the table showing all speeches of one speaker in his profile.
|
||||
Inserts a column with links to the speeches. Also defines all shown columns.
|
||||
The template
|
||||
speeches/table.html is imported in line 39.
|
||||
"""
|
||||
link = tables.LinkColumn("Rede", text="Rede", args=[A("speech_id")],
|
||||
orderable=False,
|
||||
@ -41,6 +44,8 @@ class ProtocolTable(tables.Table):
|
||||
"""
|
||||
Configures the table showing all protocols.
|
||||
Inserts a column with links to the protocols. Also defines all shown columns.
|
||||
The template
|
||||
speeches/table.html is imported in line 57.
|
||||
"""
|
||||
link = tables.LinkColumn("Protokoll", text="Protokoll", args=[A("protocol_id")],
|
||||
orderable=False,
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template is used to create the page of one protocol. -->
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template is used to create the page for the searchable protocol list. -->
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template is used to create the page of one speech. -->
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "blog/base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
<!-- This template is used to create the page for the searchable speeches list. -->
|
||||
|
||||
{% 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 speeches views.
|
||||
"""
|
||||
|
||||
urlpatterns = [
|
||||
path("reden/", views.speeches, name="Reden"),
|
||||
path("liste-protokolle/", views.protocols, name="Protokoll-list"),
|
||||
|
@ -4,7 +4,7 @@ from lxml import etree
|
||||
|
||||
def create_html_speech(speech_content_xml_string):
|
||||
"""
|
||||
COnverts the XML speech content into styled html. Also counts the words and
|
||||
Converts the XML speech content into styled html. Also counts the words and
|
||||
shows the vocabulary.
|
||||
"""
|
||||
speech_html = "<div>" + speech_content_xml_string + "</div>"
|
||||
|
@ -10,6 +10,9 @@ from collections import Counter
|
||||
|
||||
|
||||
def speech(request, speech_id):
|
||||
"""
|
||||
This view creates the page of one speech.
|
||||
"""
|
||||
try:
|
||||
current_speech = Speech.objects.get(pk=speech_id)
|
||||
if(current_speech.previous_speech_id is not None):
|
||||
@ -50,6 +53,9 @@ def speech(request, speech_id):
|
||||
|
||||
|
||||
def speeches(request):
|
||||
"""
|
||||
This view creates the searchable list of all speeches.
|
||||
"""
|
||||
if(request.method == "GET"):
|
||||
form = SearchFormSpeech(request.GET)
|
||||
if(form.is_valid()):
|
||||
@ -69,6 +75,9 @@ def speeches(request):
|
||||
|
||||
|
||||
def protocol(request, protocol_id):
|
||||
"""
|
||||
This view creates the page of one protocol.
|
||||
"""
|
||||
try:
|
||||
current_protocol = Protocol.objects.get(pk=protocol_id)
|
||||
related_speeches = Speech.objects.filter(foreign_protocol=protocol_id).order_by("speech_id")
|
||||
@ -91,6 +100,9 @@ def protocol(request, protocol_id):
|
||||
|
||||
|
||||
def protocols(request):
|
||||
"""
|
||||
This view creates the searchable list of all protocols.
|
||||
"""
|
||||
if(request.method == "GET"):
|
||||
form = SearchForm(request.GET)
|
||||
if(form.is_valid()):
|
||||
|
Reference in New Issue
Block a user