Summary of EspressoDB functionality¶
URLs¶
If you have created you project using EspressoDB, the default project url config includes the app url name spaces as
urlpatterns = [
path("", include("espressodb.base.urls", namespace="base")),
path("admin/", admin.site.urls),
path("login/", auth_views.LoginView.as_view(template_name="login.html"), name="login"),
path("logout/", auth_views.LogoutView.as_view(), name="logout"),
path(r"documentation/", include("espressodb.documentation.urls", namespace="documentation")),
path(r"notifications/", include("espressodb.notifications.urls", namespace="notifications")),
]
Module: espressodb.base.urls
¶
Contains url patterns for the base app. This includes the index view.
The URL-app name is base
.
Name |
Path |
View |
---|---|---|
index |
|
|
populate |
|
|
populate-result |
|
Module: espressodb.documentation.urls
¶
Contains url patterns for the documentation app
The URL-app name is documentation
.
Name |
Path |
View |
---|---|---|
details |
|
Module: espressodb.notifications.urls
¶
Contains url patterns for the notifications app
The URL-app name is notifications
.
Name |
Path |
View |
---|---|---|
notifications-list-debug |
|
|
notifications-list-info |
|
|
notifications-list-warning |
|
|
notifications-list-error |
|
|
notification-read |
|
Templatetags¶
Module: espressodb.base.templatetags.base_extras
¶
Additional in template functions for the base module.
-
get_item
(dictionary, key)[source] 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
-
project_name
()[source] Returns name of the project
- Return type
str
-
render_db_info
()[source] Returns descriptive db string
- Return type
str
-
render_documentation_links
()[source] 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
.
-
render_field
(field, instance_name=None)[source] 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
-
render_fields
(fields, instance_name=None)[source] 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
]
-
render_link_list
(exclude='', 'populate', 'populate-result', 'admin', 'documentation')[source] 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.
-
render_tree
(tree, root)[source] 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
.
-
render_version
()[source] Returns descriptive version string
- Return type
str
Module: espressodb.documentation.templatetags.documentation_extras
¶
Additional in template functions for the documentation module
-
render_documentation
(app_slug, model_slug)[source] Renders documentation of model
- Parameters
app_slug (
str
) – Slug of the app to be rendered. Usesespressodb.base.utilities.apps.get_apps_slug_map()
to obtain app from app names.model_slug (
str
) – Slug of the model to be rendered.
Uses the template
model-doc.html
.