base_extras¶
Module: espressodb.base.templatetags.base_extras
|
Renders all app page links |
|
Returns verbose descriptor of model field |
|
Renders fields to string. |
|
Renders a model population tree to Python code. |
Returns descriptive version string |
|
Returns descriptive db string |
|
Returns name of the project |
Additional in template functions for the base module.
Extract key from dictionary
- Parameters
dictionary (
Dict
[str
,Any
]) – The dictionary to searchkey (
str
) – The key to look up
See also: https://stackoverflow.com/a/8000091
- Return type
Any
Returns name of the project
- Return type
str
Returns descriptive db string
- Return type
str
Renders all app documentation page links
- Return type
List
[Tuple
[str
,str
]]- Returns
Context with keys
urls
anddocumentation
where each value is a list of Tuples with the reverse url name and display name.
Ignores urls which do not result in a match.
Uses the template
documentation-links.html
.
Returns verbose descriptor of model field
- Parameters
field (
Field
) – The field to render.instance_name (
Optional
[str
]) – The name of model instance for which the fields are written. If given, automatically insert the value for FK fields. This assumes that the FK variables are defined before this class and follow the convention columnname1_columnname2_….
- Return type
str
Renders fields to string.
- Parameters
fields (
List
[Field
]) – The fields to render.instance_name (
Optional
[str
]) – The name of model instance for which the fields are written. If given, automatically insert the value for FK fields. This assumes that the FK variables are defined before this class and follow the convention column_name1_column_name2_….
Sorts fields by being optional or not.
- Return type
List
[str
]
Renders all app page links
- Parameters
exclude – The link names to exclude.
- Return type
List
[Tuple
[str
,str
]]- Returns
Context with keys
urls
anddocumentation
where each value is a list of Tuples with the reverse url name and display name.
Ignores urls which do not result in a match.
Uses the template
link-list.html
.Note
It is possible to give class based views the
exclude_from_nav
flag. If this flag is set, the view will not be rendered.
Renders a model population tree to Python code.
- Parameters
tree (
Dict
[str
,str
]) – The column names ForeignKey dependency tree of the root model.root (
str
) – The name of the root model.
- Return type
Dict
[str
,str
]- Returns
Context containing the Python code unde key
content
.
Uses the template
tree-to-python.html
.
Returns descriptive version string
- Return type
str