# django-template-partials
>Reusable named inline partials for the Django Template Language.
- 📦 [https://pypi.org/project/django-template-partials/](https://pypi.org/project/django-template-partials/)
- 🛠️ [https://github.com/carltongibson/django-template-partials](https://github.com/carltongibson/django-template-partials)
## Installation
Using the auto settings of `django-template-partials` will conflict with `dj-angles`. You will need to install it using the [advanced configuration](https://github.com/carltongibson/django-template-partials#advanced-configuration).
```python
# settings.py
INSTALLED_APPS = {
...
"template_partials.apps.SimpleAppConfig",
...
}
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"OPTIONS": {
"context_processors": [
...
],
"loaders": [
(
"template_partials.loader.Loader",
[
(
"django.template.loaders.cached.Loader",
[
"dj_angles.template_loader.Loader",
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
)
],
)
],
"builtins": [
...
"template_partials.templatetags.partials",
...
],
},
},
]
```
## Define a partial
Define a template partial.
```html
TEST-PARTIAL-CONTENT
```
is equivalent to:
```html
{% partialdef test-partial %}
TEST-PARTIAL-CONTENT
{% endpartialdef %}
```
## Use a partial
Render a defined template partial.
```html
```
is equivalent to:
```html
{% partial test-partial %}
```
## Define an inline partial
Defines a template partial and renders it in-place.
```html
TEST-PARTIAL-CONTENT
```
is equivalent to:
```html
{% partialdef test-partial inline %}
TEST-PARTIAL-CONTENT
{% endpartialdef %}
```