mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Use double backticks
This commit is contained in:
parent
5eeb77f9b0
commit
1d791d08cc
1 changed files with 19 additions and 19 deletions
|
|
@ -72,7 +72,7 @@ Use this option in order to skip hash verification.
|
|||
Signals
|
||||
-------
|
||||
|
||||
Each time a value is changed it will trigger a `config_updated` signal.
|
||||
Each time a value is changed it will trigger a ``config_updated`` signal.
|
||||
|
||||
You can use it as:
|
||||
|
||||
|
|
@ -84,33 +84,33 @@ You can use it as:
|
|||
def constance_updated(sender, updated_key, new_value, **kwargs):
|
||||
print(sender, updated_key, new_value)
|
||||
|
||||
The sender is the `config` object, and the `updated_key` and `new_value`
|
||||
The sender is the ``config`` object, and the ``updated_key`` and ``new_value``
|
||||
are the ones just changed.
|
||||
|
||||
This callback will get the `config` object as the first parameter so you
|
||||
can have an isolated function where you can access the `config` object
|
||||
This callback will get the ``config`` object as the first parameter so you
|
||||
can have an isolated function where you can access the ``config`` object
|
||||
without dealing with additional imports.
|
||||
|
||||
|
||||
Custom fields
|
||||
-------------
|
||||
|
||||
You can set the field type with the third value in the `CONSTANCE_CONFIG` tuple.
|
||||
You can set the field type with the third value in the ``CONSTANCE_CONFIG`` tuple.
|
||||
|
||||
The value can be one of the supported types or a string matching a key in your :setting:`CONSTANCE_ADDITIONAL_FIELDS`
|
||||
The value can be one of the supported types or a string matching a key in your :setting:``CONSTANCE_ADDITIONAL_FIELDS``
|
||||
|
||||
The supported types are:
|
||||
|
||||
* `bool`
|
||||
* `int`
|
||||
* `float`
|
||||
* `Decimal`
|
||||
* `long` (on python 2)
|
||||
* `str`
|
||||
* `unicode` (on python 2)
|
||||
* `datetime`
|
||||
* `date`
|
||||
* `time`
|
||||
* ``bool``
|
||||
* ``int``
|
||||
* ``float``
|
||||
* ``Decimal``
|
||||
* ``long`` (on python 2)
|
||||
* ``str``
|
||||
* ``unicode`` (on python 2)
|
||||
* ``datetime``
|
||||
* ``date``
|
||||
* ``time``
|
||||
|
||||
For example, to force a value to be handled as a string:
|
||||
|
||||
|
|
@ -119,13 +119,13 @@ For example, to force a value to be handled as a string:
|
|||
'THE_ANSWER': (42, 'Answer to the Ultimate Question of Life, '
|
||||
'The Universe, and Everything', str),
|
||||
|
||||
Custom field types are supported using the dictionary :setting:`CONSTANCE_ADDITIONAL_FIELDS`.
|
||||
Custom field types are supported using the dictionary :setting:``CONSTANCE_ADDITIONAL_FIELDS``.
|
||||
|
||||
This is a mapping between a field label and a sequence (list or tuple). The first item in the sequence is the string
|
||||
path of a field class, and the (optional) second item is a dictionary used to configure the field.
|
||||
|
||||
The `widget` and `widget_kwargs` keys in the field config dictionary can be used to configure the widget used in admin,
|
||||
the other values will be passed as kwargs to the field's `__init__()`
|
||||
The ``widget`` and ``widget_kwargs`` keys in the field config dictionary can be used to configure the widget used in admin,
|
||||
the other values will be passed as kwargs to the field's ``__init__()``
|
||||
|
||||
Note: Use later evaluated strings instead of direct classes for the field and widget classes:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue