Skip to content
Options for django admin. Administrator emails, phones, contact data, etc.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Options, Labels and standalone Texts for django admin. Administrator emails, phones, contact data, etc.

qOptions package allows you to create records in database, wich you can use in your templates and views.

Works with django-modeltranslation and django-tinymce

To use modeltranslation:

Add 'modeltranslation' to INSTALLED_APPS and 'options.translation' to MODELTRANSLATION_TRANSLATION_FILES

To use django-tinymce:

Add 'tinymce' to INSTALLED_APPS


In python code you can use:

from options.functions import get_option, get_label, get_text
print get_option('your_option_key')  # 'value'
print get_label('your_label_key')  # 'value'
print get_text('your_text_key')  # ['title', 'text']

In templates:

{% load options %}
{% get_option 'your_option_key' %}
{% get_label 'your_label_key' %}

Or if you want return to context variable:

{% get_option 'your_option_key' 'my_option_key' %}
{{ my_option_key }}
{% get_label 'your_label_key' 'my_label_key' %}
{{ my_label_key }}

With texts it's a little more complicated. You need two texts, but you probably do not wont hit database or cache twice. So we return first variable directly and second as context variable.

{% get_text 'your_text_key' 'my_title' %}
{{ my_title }}

OR (if you need title first)

{% get_text_title 'your_text_key' 'my_text' %}
{{ my_text }}

Ofcourse we can return both variables as context variables:

{% get_text 'your_text_key' 'my_title' 'my_text' %}


{% get_text_title 'your_text_key' 'my_text' 'my_title' %}

{{ my_title }}: {{ my_text }}
Something went wrong with that request. Please try again.