Django AJAX ModelForms. Read-only display ModelForms. Django AJAX grids with CRUD and custom actions. Supports DTL.
Project description
Screenshot of sample application:
More screenshots with descriptions are available at: https://github.com/Dmitri-Sintsov/djk-sample/wiki
Documentation (in development): https://django-jinja-knockout.readthedocs.org/
Please contribute to the localization of the project:
Key features
Django 1.8, 1.9. 1.10 support. Python 3.4 / 3.5 support.
Supports existing Django templates (DTL).
Bootstrap 3 / Jinja2 / Knockout.js integration into 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.
Django raw queries with filter() / exclude() / order() / values() / values_list() and SQL slicing support via FilteredRawQuerySet, suitable for ListView / ListSortingView / KoGridView.
Knockout.js powered AJAX django.admin-like grids (paginated tables) with sorting / filters and custom actions.
ForeignKeyGridWidget provides ForeignKeyRawIdWidget-like functionality to select ModelForm foreign key field value via AJAX query / response.
Jinja2 templates can be integrated into existing Django templates via custom template library tag:
{% extends 'base_min.html' %} {% load jinja %} {% load staticfiles %} {% 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 %}
Major changes (version 0.3.0)
Auto-configuration of nested foreign key filter fields in KoGridView / ForeignKeyGridWidget.
FilteredRawQuerySet now supports more precise .count() method.
ListQuerySet supports significant part of Django queryset functionality for the lists of Django model instances, returned by prefetch_related().
Bootstrap tabs generation macro bs_tabs() with client-side support of switching tabs when window.location.hash value changes.
SendmailQueue functionality can be extended via injecting ioc class - for example to send email in the background via celery task.
Major changes (version 0.2.0)
$.inherit() Javascript prototype inheritance function now supports multi-level inheritance with nested .super calls without having to specify parent class prototype property implicitely in descendant class instances, with newly introduced $.SuperChain class.
“django.admin-like” AJAX functionality was implemented via KoGridView class-based view (CBV) at server-side with corresponding Knockout.js templates and Javascript classes at client-side. Besides providing standard CRUD actions and filters, it allows to implement arbitrary actions in descendant classes and quickly design django.admin-like user interfaces in non-admin views. AJAX calls also minimize server HTTP traffic, reducing network bandwitch and making the UI more responsive.
New ForeignKeyGridWidget was developed which provides ForeignKeyRawIdWidget-like functionality in non-admin ModelForm classes to select foreign key fields value via AJAX query / response.
Support of auto-instantiating Javascript classes with binding these to selected DOM nodes with ‘component’ css class via App.Components class.
Support of auto-compiling / auto-loading client-side underscore.js templates via App.compileTemplate / App.domTemplate / App.loadTemplates. One of usage examples is the possibility of loading modal body from underscore.js template in App.Dialog.
Support of client-side generation of view urls with kwargs for client-side url names via updated context_processors.py and client-side App.routeUrl() Javascript function.
tpl.resolve_cbv() allows to resolve view class via url name and it’s kwargs.
Django templates (DTL) and Jinja2 templates now can be mixed using shared Jinja2 template code via {% load jinja %} template library jinja template tags, which performs include for Jinja2 template with current context:
{% extends 'base_min.html' %} {% load jinja %} {% load staticfiles %} {% 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 %}
Numerous bug fixes.
Documentation
The full documentation is at https://django-jinja-knockout.readthedocs.org.
History
0.1.0
To be released on PyPI.
0.2.0
Django 1.8 / 1.9 / 1.10, Python 3.4 / 3.5 support.
djk-sample demo / automated testing project.
“django.admin-like” AJAX functionality implemented via KoGridView class-based view.
$.inherit() Javascript prototype inheritance function now supports multi-level inheritance with nested ._super._call().
FilteredRawQuerySet supports Django raw querysets with .filter() / .exclude() / .order_by() / .values() / .values_list() and SQL level slicing.
ForeignKeyGridWidget provides ForeignKeyRawIdWidget -like functionality via AJAX query / response in non-admin forms to select ModelForm foreign key values.
Client-side generation of view urls with kwargs in Javascript client-side routes via App.routeUrl().
Nested autocompiled underscore.js client-side templates for Javascript components, primarily used with Knockout.js, but is not limited to.
0.3.0
ContentTypeLinker - added method to return html representation of content types framework related object (html link with the description by default).
FilteredRawQuerySet now supports more precise .count() method to calculate the length of raw queryset.
ListQuerySet implements large part of queryset methods for the lists of Django model instances. Such lists are created by Django queryset .prefetch_related() method.
Auto-highlight bootstrap navs which have ‘auto-highlight’ css class at client-side.
bs_tabs() Jinja2 macro which simplifies generation of bootstrap tabs. Bootstrap tabs now support automatic switching via window.location.hash change.
ListSortingView improvements:
Supports graceful handling of error reporting, producing in-place messages instead of just rising an exception.
.get_filter_args() / .get_no_match_kwargs() methods are implemented to generate macro arguments used in bs_list.htm Jinja2 template. This allows to override default messages for field filters / no match reports in the grid classes.
KoGridView has multiple improvements:
decimal field filter is renamed to number as now it supports both Django model DecimalField and IntegerField.
Django model IntegerField is now bound either to choices type filter, when it has non-empty choices attribute, or to number type filter to select range of values, otherwise.
Action handlers do not require to return default viewmodel view name manually, now it’s being done automatically (when viewmodel view name is not specified).
get_default_grid_options() method was renamed to shorter get_grid_options() method.
grid_options may be defined as class attribute, not having to always define get_grid_options() method which is more verbose (but is more flexible).
discover_grid_options() method was implemented to populate grid fkGridOptions which are used to setup foreign key filter fields automatically (when possible). That allows to reduce boilerplate data in grid_options / get_grid_options(), especially when using nested foreign key filters. fkGridOptions nested dictionary still can be specified manually as the part of get_grid_options() result, in complex cases (eg. DB or view kwargs based options).
Enable quick selection / deselection of currently displayed grid rows when selectMultipleRows is true.
ForeignKeyGridWidget also autodetects foreign key filter fkGridOptions.
SendmailQueue supports extension of add() / flush() methods via ioc class.
SendmailQueue may be used to send uncaught exception emails when running in production mode.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-jinja-knockout-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f9cc175ed30c66e68340d28d615c359557121fa668bc756bef7f81941666fc5 |
|
MD5 | 6a2717f0fa69aa3e7a2167739a33ae26 |
|
BLAKE2b-256 | 0a0f858545f65ffc9a0918f9a3f9543133fc57376141835a7d01098172280271 |