Skip to content

Integrate neat-html as a template backend for Django.

License

Notifications You must be signed in to change notification settings

SamDudley/django-neat-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-neat-html

Integrate neat-html as a template backend for Django.

Examples

Installation

Using pip:

pip install django-neat-html

Configuration

Add the django_neat_html.NeatHtml template backend.

# my_project/settings.py

TEMPLATES = [
    ...
    {
        'NAME': 'neat_html',
        'BACKEND': 'django_neat_html.NeatHtml',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {},
    },
]

Usage

Write some components using the neat-html package.

# my_project/my_app/neats/components.py

from neat_html import Element, h

def my_page(context) -> Element:
    return h("h1", "My page")

Reference them as a template in your Django views.

# my_project/my_app/views.py

from django.template.response import TemplateResponse

def my_view(request):
    return TemplateResponse(request, "my_project.my_app.neats.component.my_page", {})

About

Integrate neat-html as a template backend for Django.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published