Templates
In django templates can be overwritten and modified by other apps.
Juntagrico provides template snippets or template blocks, that allow you to modify parts of certain templates, e.g., descriptive text or menu entries.
Note
Templates or template blocks that are not documented in this reference may change in future versions without notice. Changing undocumented and will increase your maintenance work.
If you think the changes you want to make could also benefit other juntagrico users, consider opening an issue, suggesting your changes to juntagrico directly. If you need your changes quickly, you may still want to override the templates as described here.
Hint
Some texts, e.g. of forms, do not appear in the template. To change these see below
Set up Template Overrides
The instructions for overriding templates in django can be found in the the official documentation. Roughly these are the steps:
In the
settings.py
either enable theapp_directories
template loader or setAPP_DIRS
to True on theTEMPLATES
setting. And make sure that the app with the template overrides is somewhere above'juntagrico'
in theINSTALLED_APPS
Alternatively, you can set
DIRS
to yourTEMPLATES
settings to the folder where you will place the template overrides.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True, # Option 1: This is needed for addons that override templates
'DIRS': [os.path.join(BASE_DIR, 'templates')], # Option 2: location of your overriding templates
# ...
},
]
Create a template file in your templates folder (in your app or in the project root, depending on the above setting) with the same path as the template file in juntagrico, that you want to override.
The project will now use your copy of the template instead of the original. If you only want to modify certain blocks on that template, extend the original template and modify the block(s) like this:
{% extends "path/to/this/template.html" %}
{% block block_to_override %}
{{ block.super }} {#% insert the original content of this block, if you want %#}
{#% add your own block content %#}
{% endblock %}
Email Templates
Email Templates can be overridden in the same way as every other template. Read the Notification reference to see which email templates exist.
Signup Templates
All signup pages have these 2 blocks to override:
title
: Text of the titleintro
: Text after the title
The signup templates are located in the folder createsubscription
.
Some pages have additional blocks listed below.
signup.html
intro_1
: First part of introintro_with_shares
: Part of intro, about sharesintro_2
Last part of introread_instructions
: Text on documents that should be read
forms/no_subscription_field.html
description
: Textlabel on signup option without subscriptionbase_fee
: Base fee description on signup option without subscription
select_depot.html|label
Labeltext of depot selection field
select_start_date.html
label
: Label of date selection fieldhint
: text below selection field
summary.html
Each section has a block:
profile
subscription
depot
start_date
co_member
activity_areas
shares
:comment
:
Subscription Templates
juntagrico/my/subscription/single.html|extend
Add content to the subscription overview page, for members that have a subscription.
juntagrico/my/subscription/none.html|extend
Add content to the subscription overview page, for members that have no subscription.
Depot Templates
depot.html
Each section has a block to overwrite or extend it:
address
pickup
contact
description
access_information
map
Activity Area Templates
juntagrico/my/area/snippets/intro.html|all
Override the intro text on the activity area overview page
Membership Templates
cancelmembership.html|intro
Text after title
profile.html
Blocks exist for the text in the info banner on top and for the buttons
info_canceled
info_active
button_change_password
button_cancel_membership
Widget Templates
juntagrico/widgets/assignment_progress.html|progress
Change appearance of the assignment progress widget in menu.
E.g. to use the bean icon indicators of previous juntagrico versions do:
{% extends 'juntagrico/widgets/assignment_progress.html' %}
{% load juntagrico.widgets %}
{% block progress %}
{% assignment_progress request.user.member future=False as assignments %}
{% include "./assignment_progress/classic.html" %}
{% endblock %}
The future
argument on assignment_progress
specifies if planned future assignments are counted as well:
None: Count future assignments
False: Don’t count future assignments
True: Count future assignments separately. This is not supported by the classic assignments widget.