Package: django-jinja-knockout
Screenshot of thesample project:More screenshots with descriptions are available at:https://github.com/Dmitri-Sintsov/djk-sample/wikiDocumentation (in development):https://django-jinja-knockout.readthedocs.org/Supports Django 4.2 LTS, 5.0; Python 3.10 / 3.11 / 3.12.Please contribute to the localization of the project:django-jinja-knockout python localizationdjango-jinja-knockout javascript localizationLocalization:Chinese:goldmonkeyDutch:Melvyn SopacuaPolish:pawelkostonSpanish:Julio Cesar Cabrera Cabrera,kiwnixKey featuresAJAX based django.admin-like paginateddatatables(grids) with sorting / filters and custom actions.Integrates Jinja2 into existing Django templates (DTL).Bootstrap 3/Bootstrap 4/Bootstrap 5/Jinja2/Knockout.jsfor Django projects.No deep knowledge of Knockout.js is required: it has ready working components.Dynamic adding / removing of inline formsets with Knockout.js, protected from XSS.Default template renderers for Django forms / related forms / inline formsets with the possibility to override these
to customize the visual layout.ForeignKeyGridWidgetprovidesForeignKeyRawIdWidget-like functionality to selectModelFormforeign key
field value via AJAX query / response.Django raw queries withfilter()/exclude()/order()/values()/values_list()and SQL slicing
support viaFilteredRawQuerySet, suitable for usage inListView/ListSortingView/KoGridViewderived
classes.ListQuerySetto query Python lists, includingprefetch_related()results.Jinja2 templates can be integrated into existing Django templates via custom template library tag:{% extends 'base_min.html' %}
{% load jinja %}
{% load static %}

{% block main %}
{% jinja 'bs_list.htm' with _render_=1 view=view object_list=object_list is_paginated=is_paginated page_obj=page_obj %}
{% endblock main %}OverviewKnockout.js uses unobtrusivedata-bindHTML attributes with JSON-like values with causes no conflict to server-side
double braces template syntax of DTL / Jinja2: no need to escape templates.Combining client-side Knockout.js templates and server-side Jinja2 templates allows to write more powerful and compact
template code.Jinja2 is faster and is more powerful than built-in DTL templates. Jinja2 templates may be called from DTL templates
by using custom template tag library{% load jinja %}.Useshttps://github.com/knockout/knockouthttps://github.com/mitsuhiko/jinja2Provides DTL tag library to include Jinja2 templates into DTL templates.Knockout.js is used to providedatatablesand for XSS-safeempty_formhandling.AJAX form validation, AJAXviewmodelsresponse routing are implemented via bundled client-side scripts.It’s not a pure SPA framework, but a mixed approach of server-side pages with embedded AJAX content and client-side
scripts. Although it may be used for SPA as well. Classical Web applications aren’t “outdated” in any way - because such
applications are much better indexable by web crawlers, Python is better language than Javascript in general, also
server-side rendering generally is more robust.Version 2.2.1Python 3.12 / Django 5.0 compatibility.Useaxiosinstead of outdated jQuery.form plugin.Version 2.2.0FormFieldsRenderer/fields_templateallows fine-grained customization ofModelFormfields layout.ListQuerySetnow has basic support of.delete()method and most commonaggregatefunctions:Count,Min,Max,Sum.LoadjQuery.form/Moment.js/ Bootstrap Datetimepicker ases6 modules, which may be included intodjango_denogenerated bundle.QueryStringwrapper forUrlSearchParams.AdditionalKoGridViewclient-side layout options:Bootstrap navs style of Grid filter choices:ko_grid_navs_filter_choicesshowNonSortableColumnNamesoptionbutton_paginationbuilt-in action typeNested componentsare supported in Grid cells, including the cells ofCompound columns.Tpl.domTemplateoptional template kwargs support.djk_bootstrap5now uses nativeBootstrap Iconsfont foriconuiactions.Various bugfixes.Version 2.1.0Built-incustom elements, including es5 IE11 polyfills.Bootstrap 5compatibility.ObjDictDjango model serializer with built-in field permissions check for AJAXviewmodels, includingdatatables.get_absolute_urlwith optional user permission check / link title generation.Version 2.0.0Built-ines6 modulessupport for modern browsers.OptionalSystemJSloader support for IE11 viadjango_deno.Optional minifiedterserbundles support both fores6 modulesand forSystemJSloader viadjango_deno.datatablessupport separate cell click actions, not just row actions.More throughout support fordatatablesannotated fields / virtual fields viagrid_fieldsdicts.Optional lazy registration of client-side components.Numerous fixes, including improved related grid view kwargs auto-detection, seepageRouteKwargsKeysandpageRouteKwargsKeys example.ListRangeFilterforListSortingViewrange fields.DocumentationThe full documentation is athttps://django-jinja-knockout.readthedocs.org.