-
Notifications
You must be signed in to change notification settings - Fork 4
Home
This project serves both the purpose of testing django-jinja-knockout, as well as quick showcase of it's key features:
Create AJAX-powered grids bound to Django models with sorting, filtering and inline editing,
supporting both single ModelForm
and ModelForm
with related inline formsets:
![https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_edit_inline.png](https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_edit_inline.png)
Grid may have ModelForm
field filters of various types, which can be detected automatically,
or setup manually. Next types of fields are automatically mapped to their built-in filters:
ForeignKey
BooleanField
DateField
DateTimeField
DecimalField
-
ModelForm
fields which havechoices
attribute are mapped to dropdowns with lists of choices
Here is the screenshot of foreign key filter dialog:
![https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_foreign_key_filter.png](https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_foreign_key_filter.png)
Foreign key widget dialog powered by AJAX grid allows to select foreign keys ModelForm
fields
from the paginated list. Widget dialog allows to order / search / filter specified Django model
fields.
Also it is possible to create new related objects / update existing objects directly from widget dialog, enabling nested AJAX ModelForm editing of related objects with unlimited nesting depth.
The widget works both with classical non-AJAX ModelForm
and with AJAX ModelForm
, which are
embedded in pages or into BootstrapDialogs:
![https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_change_or_create_foreign_key_for_inline_form.png](https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_change_or_create_foreign_key_for_inline_form.png)
Knockout.js is used to add / remove inline formset empty_form
safely, not executing custom fields
embedded Javascript code abruptly:
![https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_delete_inline_form.png](https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_delete_inline_form.png)
Besides standard CRUD actions which may be enabled or disabled selectively, custom actions for the whole grid or selected grid columns may be implemented both at client-side (Javascript) and server-side (Python).
Both grid layout and grid rows display can be customized via methods overloading (Javascript, Python).
Here is the example of grid used as AJAX form where ModelForm
column 'endorsed' is rendered as
input checkbox and a custom grid action issued via pressing of custom 'Change endorsement' button.
After execution of the action, not only target grid rows are highligted, but also description dialog could be optionally rendered with the list of modified objects. The same list can be generated for client-side actions, including client-side forms which do not generate extra HTTP requests.
![https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_render_description.png](https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_render_description.png)