Advanced Setup

Addons

You can install the following addons to extend the functionality of Juntagrico:

The linked repositories contain additional information and installation instructions.

Rich Text Editor

Juntagrico uses django-richtextfields. You can find more information on the configuration options here https://pypi.org/project/django-richtextfield/

The examples below use the TinyMCE editor, which comes pre-installed with juntagrico. You may use any other editor.

Mailer

You can customize the rich text field in the mailer in the settings.py using:

from juntagrico import defaults

DJRICHTEXTFIELD_CONFIG = defaults.richtextfield_config(LANGUAGE_CODE, mailer={
    # your configuration settings
})

Admin Interface

The rich text editor in the admin interface allows formatting text of most descriptions, like the job descriptions, entered through the admin interface, This feature is disabled by default. Use the steps below to enable it.

Warning

When the rich text editor is enabled, text, when saved, will be saved as HTML. Disabling the rich text editor will not convert the text back. The HTML has to be converted back manually.

Note

When text from rich text fields is used in plain text emails the HTML tags need to be removed using the striptags filter. This is done in the default email templates. You will have to do it in your customized email texts as well.

To enable the rich text editor you have to modify the following setting.

from juntagrico import defaults

DJRICHTEXTFIELD_CONFIG = defaults.richtextfield_config(LANGUAGE_CODE, use_in_admin=True)

Instead you can also pass your custom configuration to the admin argument.

DJRICHTEXTFIELD_CONFIG = defaults.richtextfield_config(LANGUAGE_CODE, admin={
    # your configuration settings
})

Custom Templates

Templates can be modified, e.g., to change texts or menu entries. See Templates Reference.

Custom Code

You can modify juntagrico with your own code. Use the provided Hooks, link to the emitted Signals or create your own Exports.

Warning

juntagrico may change in the future and you will have to maintain your changes accordingly. Instead of making complex modifications, try opening a feature request, to either get your modifications included in juntagrico or at least get an official hook to do your changes.

Modifications can be made, once all django apps have been loaded, i.e. in the ready method of your app config in apps.py in the main folder of your project or addon:

from django.apps import AppConfig
from juntagrico.util import addons

class MyConfig(AppConfig):
    name = 'myapp'
    verbose_name = "My App"

    def ready(self):
        addons.config.register_user_menu('my_user_menu.html')
        # register other hooks
        # Add Monkey-Patches ..

Modifying Text in Code

Some text is written directly into code instead of templates. These texts can be modified with Custom Code.

def ready(self):
    # import the form to patch
    from juntagrico.forms import RegisterMemberForm
    # modify text variable (check the form implementation to see if this is available)
    RegisterMemberForm.text['accept_wo_docs']= 'I accept'
    # modify field labels of a ModelForm
    RegisterMemberForm.base_fields['phone'].label = 'Tel'
    # modify the text in a submit button
    old_init = RegisterMemberForm.__init__

    def my_init(self, *args, **kwargs):
        old_init(self, *args, **kwargs)
        self.helper.layout[-1].fields[0].value = 'Go'

    RegisterMemberForm.__init__ = my_init