Commit 57ce8ac4 authored by Tom Teichler's avatar Tom Teichler 🍻
Browse files

Add docs. Advances AlekSIS#158

parent 172171d6
......@@ -10,6 +10,8 @@ untis_mysql = Section("untis_mysql", verbose_name=_("UNTIS: MySQL"))
@site_preferences_registry.register
class UpdateSubjects(BooleanPreference):
"""Update values of existing subjects."""
section = untis_mysql
name = "update_subjects"
default = True
......@@ -18,6 +20,8 @@ class UpdateSubjects(BooleanPreference):
@site_preferences_registry.register
class UpdatePersonsShortName(BooleanPreference):
"""Update short name of existing persons."""
section = untis_mysql
name = "update_persons_short_name"
default = False
......@@ -26,6 +30,8 @@ class UpdatePersonsShortName(BooleanPreference):
@site_preferences_registry.register
class UpdatePersonsName(BooleanPreference):
"""Update name of existing persons."""
section = untis_mysql
name = "update_persons_name"
default = False
......@@ -34,6 +40,8 @@ class UpdatePersonsName(BooleanPreference):
@site_preferences_registry.register
class UpdateGroupsShortName(BooleanPreference):
"""Update short name of existing groups."""
section = untis_mysql
name = "update_groups_short_name"
default = False
......@@ -42,6 +50,8 @@ class UpdateGroupsShortName(BooleanPreference):
@site_preferences_registry.register
class UpdateGroupsName(BooleanPreference):
"""Update name of existing groups."""
section = untis_mysql
name = "update_groups_name"
default = False
......@@ -50,6 +60,8 @@ class UpdateGroupsName(BooleanPreference):
@site_preferences_registry.register
class OverwriteGroupOwners(BooleanPreference):
"""Overwrite group owners."""
section = untis_mysql
name = "overwrite_group_owners"
verbose_name = _("Overwrite group owners")
......@@ -58,6 +70,8 @@ class OverwriteGroupOwners(BooleanPreference):
@site_preferences_registry.register
class UpdateRoomsName(BooleanPreference):
"""Update name of existing rooms."""
section = untis_mysql
name = "update_rooms_name"
default = True
......@@ -66,6 +80,8 @@ class UpdateRoomsName(BooleanPreference):
@site_preferences_registry.register
class UpdateSupervisionAreas(BooleanPreference):
"""Update existing supervision areas."""
section = untis_mysql
name = "update_supervision_areas"
default = True
......@@ -74,6 +90,8 @@ class UpdateSupervisionAreas(BooleanPreference):
@site_preferences_registry.register
class UseCourseGroups(BooleanPreference):
"""Use course groups."""
section = untis_mysql
name = "use_course_groups"
default = True
......
......@@ -31,6 +31,7 @@ def get_child_node_id(node: Node, tag: str) -> Optional[str]:
def untis_import_xml(request: HttpRequest, untis_xml: Union[BinaryIO, str]) -> None:
"""Import Untis data from Untis XML export."""
dom = defusedxml.parse(untis_xml)
subjects = dom.getElementsByTagName("subject")
......
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Configuration and administration
================================
.. toctree::
:glob:
*
Quickstart
==========
Install AlekSIS-App-Untis
-------------------------
To install AlekSIS-App-Untis, simply install its latest release from PyPi::
pip install AlekSIS-App-Untis
or the latest development release::
pip install git+https://edugit.org/AlekSIS/official/AlekSIS-App-Untis
After that, run migrations and collect static files::
poetry run django-admin migrate
poetry run django-admin collectstatic --no-input
AlekSIS-App-Untis XML import works out-of-the-box. If you want to import Untis data via MySQL, you have to configure an additional database.
Setup MySQL database for Untis data (optional)
==============================================
To work with MySQL data from Untis, an additional database is required. To enable this, add the following to your ``/etc/aleksis/aleksis.toml``::
[default.untis.database]
enabled = true
name = "untis"
user = "untis"
password = "password"
host = "localhost"
port = 3306
After restarting your AlekSIS instance, run database migrations::
poetry run django-admin migrate
If you not configure a MySQL database, you only can import data exported as XML.
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import django
sys.path.insert(0, os.path.abspath(".."))
os.environ["DJANGO_SETTINGS_MODULE"] = "aleksis.core.settings"
os.environ["LOCAL_SETTINGS_FILE"] = os.path.abspath(os.path.join("..", "local.cfg"))
django.setup()
# -- Project information -----------------------------------------------------
project = "AlekSIS-App-Untis"
copyright = "2019, 2020, AlekSIS team"
author = "AlekSIS team"
# The short X.Y version
version = "2.0"
# The full version, including alpha/beta/rc tags
release = "2.0a3.dev0"
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinxcontrib_django",
"sphinx_autodoc_typehints",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = "AlekSIS-App-Untisdoc"
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "AlekSIS-App-Untis.tex", "AlekSIS-App-Untis Documentation", "AlekSIS team", "manual"),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "aleksis", "AlekSIS-App-Untis Documentation", [author], 1)]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"AlekSIS-App-Untis",
"AlekSIS-App-Untis Documentation",
author,
"AlekSIS",
"One line description of project.",
"Miscellaneous",
),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ["search.html"]
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"https://docs.python.org/": None,
"https://docs.djangoproject.com/en/stable": "https://docs.djangoproject.com/en/stable/_objects",
}
Welcome to AlekSIS-App-Untis’ documentation!
==============================================
.. toctree::
:maxdepth: 2
:caption: Contents:
admin/00_index
ref/00_index
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
API and module reference
========================
.. toctree::
:glob:
untis/*
Untis data models
====================
.. automodule:: aleksis.apps.untis.models
:members:
Utillity code for importers
===========================
AlekSIS-App-Untis can import data from untis via XML or MySQL.
Main MySQL import utillity
---------------------------
.. automodule:: aleksis.apps.untis.util.mysql.util
:members:
Main XML import utillity
---------------------------
.. automodule:: aleksis.apps.untis.util.xml.xml
:members:
Import of absences
------------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.absences
:members:
Import of common data
----------------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.common_data
:members:
Import of events
----------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.events
:members:
Import of holidays
------------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.holidays
:members:
Import of lessons
-----------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.lessons
:members:
Import of substitutions
-----------------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.substitutions
:members:
Import of school terms
----------------------
.. automodule:: aleksis.apps.untis.util.mysql.importers.terms
:members:
Preferences
===========
AlekSIS-App-Untis allows to configure some options for for MySQL import.
.. automodule:: aleksis.apps.untis.preferences
:members:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment