Skip to content
This repository was archived by the owner on Sep 18, 2022. It is now read-only.
This repository was archived by the owner on Sep 18, 2022. It is now read-only.

add_to_builtins in settings.py fails #116

@vanschelven

Description

@vanschelven

Hi,

When using the django-uni-form templatetags through add_to_builtins in settings.py (the most logical location for using add_to_builtins) the server fails to start.

This is a new bug since after 0.7.0.

It is caused by the use of get_template in the templatetags modules. Since get_template is called at module load-time and get_template requires settings.py to have been fully loaded your code cannot be imported from settings.py.

An example of a call to get_template at module root (i.e. not inside some function) is:
https://github.com/pydanny/django-uni-form/blob/master/uni_form/templatetags/uni_form_tags.py#L142
But there are more, grepping will quickly reveal them.

A simple solution would be to make the associated variables lazily initialized, i.e. set them as None at module-load time and always access them via some getter that checks their value. If necessary I could provide this code for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions