Indices and tables¶
Installation¶
Django-dynamic-breadcrumbs can be installed from PyPI with tools like pip
:
$ pip install django-dynamic-breadcrumbs
Then add 'dynamic_breadcrumbs'
to your INSTALLED_APPS
.
INSTALLED_APPS = [
...
'dynamic_breadcrumbs',
]
Requirements¶
Django-dynamic-breadcrumbs is tested against these supported versions of Python and Django
Python: 3.8
Django: 3.2
Getting Started¶
Add to settings¶
Add dynamic_breadcrumbs.context_processors.breadcrumbs to context_processors:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
#...
"dynamic_breadcrumbs.context_processors.breadcrumbs",
],
},
},
]
Add template¶
Include the dynamic_breadcrumbs/breadcrumbs.html in your base template.
{% if breadcrumbs %}
<div class="container">
{% include "dynamic_breadcrumbs/breadcrumbs.html" with breadcrumbs=breadcrumbs%}
</div>
{% endif %}
Settings Reference¶
List of all available settings of django-dynamic-breadcrumbs and their default values.
All settings are prefixed with DYNAMIC_BREADCRUMBS_
.
Running the Test Suite¶
To run the django-dynamic-breadcrumbs tests checkout the source code and create a virtualenv where you can install the test dependencies.
Note
The following assumes you have virtualenv and git installed.
Clone the repository¶
Get the source code using the following command:
$ git clone https://github.com/marcanuy/django-dynamic-breadcrumbs.git
Switch to the django-dynamic-breadcrumbs directory:
$ cd django-dynamic-breadcrumbs
Set up the virtualenv¶
Create a new virtualenv to run the test suite in:
$ python3 -m venv ~/.virtualenvs/django-dynamic-breadcrumbs
Then activate the virtualenv and install the test requirements:
$ source ~/.virtualenvs/django-dynamic-breadcrumbs/bin/activate
$ pip install -r requirements/test.txt
Execute the test runner¶
Run the tests with the runner script:
$ make tests-run
Test all supported versions¶
To run the tests against all supported versions of Python and Django use tox, then:
$ tox
Formatting¶
Python code is formatted with black
$ black .