Skip to content
Snippets Groups Projects
Commit 9f13bdd2 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Raise docs version, add docs for materialize, extensible models and merging app settings

parent 692a99f1
No related branches found
No related tags found
1 merge request!333Documentation for beta release (Documentation for first release part 1)
Pipeline #3057 failed
......@@ -31,7 +31,7 @@ author = "AlekSIS team"
# The short X.Y version
version = "2.0"
# The full version, including alpha/beta/rc tags
release = "2.0a1"
release = "2.0a3.dev0"
# -- General configuration ---------------------------------------------------
......
Materialize templates
======================
AlekSIS frontend uses with the `MaterializeCSS`_ framework.
Internationalization
--------------------
Load the ``i18n`` template tag and start translating strings in templates with
the following template tags::
{% blocktrans %}String{% endblocktrans %}
{% trans "String" %}
``{% blocktrans %}`` is mostly used for multiple words or multiline, while ``{%
trans %}`` is used for single words.
Title and headlines
-------------------
To add a main headline or browser title to your template, you can add the
following blocks to your template::
{% block browser_title %}Title{% endblock %}
{% block page_title %}Headline{% endblock %}
Forms in templates
------------------
The django MaterializeCSS integrations provides support for forms in
template.
You just have to load the ``material_form`` templatetag in the ``{% load %}``
block.
The following snippet generates the form::
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{% form form=form %}{% endform %}
{% include "core/partials/save_button.html" %}
</form>
``{% include "core/partials/save_button.html" %}`` includes a template snippet
from AlekSIS core. You can modify the buttons icon and translatable caption
like this::
{% trans "Edit" as caption %}
{% include "core/partials/save_button.html" with caption=caption, icon="person" %}
In your ``forms.py`` you can configure the layout of the fields like in the EditPersonForm::
class EditPersonForm(ExtensibleForm):
"""Form to edit an existing person object in the frontend."""
layout = Layout(
Fieldset(
_("Base data"),
"short_name",
Row("user", "primary_group"),
"is_active",
Row("first_name", "additional_name", "last_name"),
),
Fieldset(_("Address"), Row("street", "housenumber"), Row("postal_code", "place")),
Fieldset(_("Contact data"), "email", Row("phone_number", "mobile_number")),
Fieldset(
_("Advanced personal data"), Row("sex", "date_of_birth"), Row("photo"), "guardians",
),
)
.. _MaterializeCSS: https://materializecss.com/
Extensible models
=================
In AlekSIS you can use ``ExtensibleModels`` to add model fields to other
apps models.
If you want to make your apps models extensible, use the ``ExtensibleModel``
class as parent class of your models.
If you want to extend other apps extensible models, create a new file
``model_extensions.py``::
from django.utils.translation import gettext_lazy as _
from jsonstore import CharField
from aleksis.core.models import Group
Group.field(example=CharField(verbose_name=_("Example field"), blank=True))
Merging of app settings
=======================
AlekSIS provides features to merge app settings into main ``settings.py``.
Currently mergable settings
---------------------------
* INSTALLED_APPS
* DATABASES
* YARN_INSTALLED_APPS
* ANY_JS
If you want to add another database for your AlekSIS app, you have to add
the following into your ``settings.py``::
DATABASES = {
"database": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "database",
"USER": "database",
"PASSWORD": "Y0urV3ryR4nd0mP4ssw0rd",
"HOST": "127.0.0.1",
"PORT": 5432,
}
If you install new apps and want to configure these, or need some other settings you can easily add
settings to your ``settings.py``. Only settings that does not exist in the
main ``settings.py`` will be respected.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment