diff --git a/docs/conf.py b/docs/conf.py index 5817b0ad2b1195aeb704d7561fa57aec5a6d880a..6f053e9f4013408dc4c2ebdae5fa9e3969a4da48 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 --------------------------------------------------- diff --git a/docs/dev/04_materialize_templates.rst b/docs/dev/04_materialize_templates.rst new file mode 100644 index 0000000000000000000000000000000000000000..545d4ed8a3b6846b1d81fbdfd346424a50b90f25 --- /dev/null +++ b/docs/dev/04_materialize_templates.rst @@ -0,0 +1,73 @@ +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/ diff --git a/docs/dev/05_extensible_models.rst b/docs/dev/05_extensible_models.rst new file mode 100644 index 0000000000000000000000000000000000000000..1be12c0eae74ec8443ab20f2d6abf7047884f4f7 --- /dev/null +++ b/docs/dev/05_extensible_models.rst @@ -0,0 +1,19 @@ +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)) diff --git a/docs/dev/06_merging_app_settings.rst b/docs/dev/06_merging_app_settings.rst new file mode 100644 index 0000000000000000000000000000000000000000..5c8bc1f65cced9153946bf36fbd005740e5fabb7 --- /dev/null +++ b/docs/dev/06_merging_app_settings.rst @@ -0,0 +1,29 @@ +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.