Glossary

Some of the terms used in other articles are explained here. The terms from the glossary are shown in italic in the other articles.

In order to better understand these terms, I'll use the following example.

FAVORITE_SUBJECTS = SimpleStringsList(
    "mysubject",
    comment_starts_with="//",
    help="my favorite songs subjects"
)

admin preview

or setting admin preview

When the admin changes the raw value in Django Admin, the admin panel shows a preview that somehow illustrates the value. Sometimes, it is tricky when you need to show a value of callable type.

callable type

When the setting value is callable, so in code you need to call the value, for example content_settings.FAVORITE_SUBJECTS(). Most of the callable types can be found in content_settings.types.template.

content tags

Tags for the setting generated by the value of the setting.

db value

or setting db value

Raw value that is stored in the database.

default value

or setting default value

"mysubject" - raw value that will be used for database initialization or for cases when db value is not set.

definition

or setting definition

The example above shows the full setting definition. Includes name and type definition.

django settings

As we use settings to refer to content settings, we will use django settings for actual Django settings constants.

instance

or setting instance

The result of calling the type definition. The instance is responsible for converting, parsing, and validating processes.

JSON value

or setting JSON value

JSON representation of the value for API. Generated by json_view_value of the instance.

lazy value

or setting lazy value

Use setting with prefix that returns value as a lazy object. Can be useful when you need to save a reference to the value in a global environment before the python object generation. Example: content_settings.lazy__FAVORITE_SUBJECTS. Generated by lazy_give of the instance, see also content_settings.types.lazy.

mixin

or setting mixin

In the setting definition, you can extend setting type with a list of mixins using the mixin function (the function and most of the available mixins can be found in content_settings.types.mixins). Example: DAYS_WITHOUT_FAIL = mix(MinMaxValidationMixin, SimpleInt)("5", min_value=0, max_value=10, help="How many days without fail") - type SimpleInt was extended with the mixin MinMaxValidationMixin, which adds new optional attributes min_value and max_value and validates if the python object is within a given range.

name

or setting name

FAVORITE_SUBJECTS - the unique name of your setting. Should always be uppercased. By the same name, you can use setting and change it in Django Admin.

prefix

or setting prefix

A content setting method that can return something other than setting value. For example, content_settings.lazy__FAVORITE_SUBJECTS - lazy is a prefix and the whole use returns the lazy value of the setting FAVORITE_SUBJECTS. The register_prefix allows new prefix registration.

python object

or setting python object or py object

The object generated by converting the raw value when starting the server (or when the raw value is changed). Generated by the method to_python of the setting instance.

raw value

or setting raw value

The initial value, always a string. This value is parsed/converted using the setting instance.

suffix

or setting suffix

An extra attribute that extends the give method that returns value. For example, content_settings.FAVORITE_SUBJECTS__first - first is a suffix. Suffixes are convenient for cases when you need to extract some other data from the python object, not only the value, or you need to return value in a different way for special cases.

type

or setting type

SimpleStringsList - All of the built-in classes can be found in content_settings.types.

type arguments

or setting type arguments

comment_starts_with="//", help="my favorite songs subjects".

type definition

or setting type definition

SimpleStringsList("mysubject", comment_starts_with="//", help="my favorite songs subjects").

use setting

or setting use

When you use a setting in the Python code content_settings.FAVORITE_SUBJECTS or in a template {{CONTENT_SETTINGS.FAVORITE_SUBJECTS}}. All of these code examples return the setting value.

user defined types

Types that are allowed to be used for user-defined settings. More about it here.

user defined settings

Settings that are created in Django Admin by the user (not by code). More about it here.

value

or setting value

The value that will be returned when you use setting. Generated by the give method for the setting instance for each use. For the most basic types, value is the same as the python object.

Stand With Ukraine