- To be released on PyPI.
- Django 1.8 / 1.9 / 1.10, Python 3.4 / 3.5 support.
djk-sampledemo / 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.
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.ListSortingViewimprovements:- 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:
decimalfield filter is renamed tonumberas now it supports both Django modelDecimalFieldandIntegerField.- Django model
IntegerFieldis now bound either tochoicestype filter, when it has non-emptychoicesattribute, or tonumbertype filter to select range of values, otherwise. - Action handlers do not require to return default viewmodel
viewname manually, now it's being done automatically (when viewmodelviewname is not specified). get_default_grid_options()method was renamed to shorterget_grid_options()method.grid_optionsmay be defined as class attribute, not having to always defineget_grid_options()method which is more verbose (but is more flexible).discover_grid_options()method was implemented to populate gridfkGridOptionswhich are used to setup foreign key filter fields automatically (when possible). That allows to reduce boilerplate data ingrid_options/get_grid_options(), especially when using nested foreign key filters.fkGridOptionsnested dictionary still can be specified manually as the part ofget_grid_options()result, in complex cases (eg. DB or view kwargs based options).- Enable quick selection / deselection of currently displayed grid rows when
selectMultipleRowsistrue.
- ForeignKeyGridWidget also autodetects foreign key filter
fkGridOptions. SendmailQueuesupports extension ofadd()/flush()methods via ioc class.SendmailQueuemay be used to send uncaught exception emails when running in production mode.
- Improvements in testing support:
AutomationCommandsnow uses yield to generate the sequence of opcodes and their args, resulting in cleaner code.SeleniumCommandsis reworked intoBaseSeleniumCommands. It supports:- Saving current database state to Django fixtures at the particular points of tests via dump_data command. That
allows to skip already debugged parts of tests via .has_fixture() method, greatly reducing the time
required to develop and debug long running Selenium tests. To make proper order (sequence) of stored / loaded
fixtures, one has to define fixtures_order attribute of
DjkTestCasederived class. - Automatic retry of the last Selenium commands execution in case current command is timed out when running at slow client due to DOM is not being updated in time.
- css parsing / xpath string escaping.
- Saving current database state to Django fixtures at the particular points of tests via dump_data command. That
allows to skip already debugged parts of tests via .has_fixture() method, greatly reducing the time
required to develop and debug long running Selenium tests. To make proper order (sequence) of stored / loaded
fixtures, one has to define fixtures_order attribute of
SeleniumQueryCommandsimplements generic Selenium commands, including Django reverse url support for navigation bar, anchors and forms, which could be useful in any Django application.DjkSeleniumQueryCommandsimplements additional Selenium commands related to django-jinja-knockout functionality, such as BootstrapDialog and Knockout.js grids / widgets support.
BootstrapModelFormalways populates.requestattribute for convenience.CustomFullClean/StripWhitespaceMixinmixins for Django forms.
ContextMiddlewareclass:- Supports request mocking when running not under HTTP server, for example as shell command / celery task.
- Supports request-time storage of lists / dicts of objects via add_instance / yield_out_instances methods.
- FilteredRawQuerySet supports Q expressions (Q objects) with relation mapping.
BaseFilterViewfilter_queryset()now supports args in addition to kwargs. That allows to use DjangoQobjects in grids and lists, although actual generation ofQobjects is still limited toNonevalue filtering.Nonecan be valid value of field filter query. It is mapped tois_nullfield lookup, also it uses DjangoQ.__or__operation in caseNoneis presented in the list of field filter values.- Query filters now support
inclause for drop-downchoicefilter.
DisplayTextfield widget__init__()method now supports two types ofget_textcallback arguments:get_text_methodwhich binds passed function to DisplayText widget instance (self as first argument)get_text_fnwhich uses unbound function (no self).
If form that defined widget uses WidgetInstancesMixin and model field instance has get_str_fields() method
implemented, such field will be auto-rendered via print_list_group() / print_bs_well() functions of tpl
module to produce structured output.
- Fixed
ko_grid_body()macro not including underscore.js templates copied with differenttemplate_idwhen these templates were called from related underscore.js templates.
Reset filter now uses
undefinedvalue instead ofnullvalue because filtering byNonevalue is now supported in KoGridView.App.ko.GridRowclassdisplay()method now automatically picks nested relation value from nestedstrFieldsvalue, when available. That allows to traverse nestedget_str_fields()values automatically.See
getDisplayValue()method for the implementation.Allow to click nested elements of row cells when these are enclosed into anchors.
Allow to override grid callback action via viewmodel
callback_actionproperty.Query filters now support multi-value
inclause for values of drop-downchoicefilter.Grid viewmodel
deleted_pkskey values are processed first inApp.ko.Grid.updatePage(). That allows to delete old row and add new row with the samepkValat once (forced update).App.ko.Gridclass.setFiltersChoices()method simplifies programmatic filtering of grid at client-side, for example from the parsed querystring.
$.linkPreview now has separate inclusion filter for local urls and exclusion filter for remote urls, which minimizes
the possibility of preview glitches due to wrong guess of resource type.
Support of the 'choices' filter option multiple_choices: True in non-AJAX ListSortingView. That allows
to perform in field lookups for the selected field filter which was previously available only in AJAX
KoGridView.
Large monolithic views.py split into smaller parts with symbols exported via module __init__.py for the
convenience and compatibility.
Alternative breadcrumbs layout of field filters widgets.
- Compatibility to 1.10+ new-style middleware (thanks to Melvyn Sopacua).
- Fixed pagination when multiple filter field choices are selected in views.ListSortingView.
- Django 1.11 / Python 3.6 support.
- Selenium testing commands fixes.
- Reworked recursive underscore.js template processor as
App.Tplclass. - Grid rows, grid row actions and ForeignKeyGridWidget placeholder now are displaying Django model instances verbose field names along with their values. Related model fields verbose names are displayed as well.
- Client-side components code now uses separate html5 data attribute
data-component-classto bind DOM subtrees to Javascript component classes (for example grids), instead of placing everything intodata-component-optionsattribute as in previous versions. - Overridable method to check whether two grid rows match the same Django model instance, suitable for RAW query
grids with LEFT JOIN, which could have multiple rows with the same
pkVal===null. - Automation commands now uses
SimpleNamespaceas chained context, which allows to use different nodes for relative search queries chaining. Currently implemented are relative Selenium queries for form, component, bootstrap dialog and grid. Much better tests coverage in djk-sample project. Many new Selenium commands are implemented, includingscreenshotcommand. ko_generic_inlineformset_factorysupports dynamic adding / removal of generic inline formsets.- FilteredRawQuerySet / ListQuerySet queryset classes
values()andvalues_list()methods now support model relations in queried field names via__separator, just like usual Django querysets. - Numerous bugfixes.
ActionsViewwithApp.Actionsclient-side counterpart implements AJAX viewmodels routing to create generic AJAX actions / responses. It is now used as base foundation forApp.ModelFormDialog/ModelFormActionsViewand with knockout datatables actions (see modelFormAction method).ModelFormActionsViewwithApp.ModelFormActionsclient-side counterpart allows to use Django forms / inline formsets with AJAX-powered BootstrapDialog viaApp.EditForm/App.EditInlineclient-side components.- Selective skipping of
DisplayTextfield widget rendering via settingskip_outputproperty inget_text_methodcallback. - Do not bind
App.ko.Formsetto display-onlybs_inline_formsets()generated forms with inline formsets. - Knockout grids (datatables)
'button_footer'built-in action type. - djk_seed Django management command.
App.renderNestedListsupports rendering ofjQueryobjects values.App.TabPanesupports hiding / dynamic content loading of bootstrap 3 panes.App.Dialogis now closable by default.App.Dialognow can be run as component.htmlandreplaceWithviewmodels appliesApp.initClienthooks, also works correctly with viewmodel.htmlcontent that is not wrapped into top tags.- Implemented
App.propByPathwhich is now used to load Javascript object specified forApp.renderNestedListasoptions.blockTagsstring. That allows to pass Javascript path string asoptions.blockTagsvia server-side AJAX response.App.Dialogclass,'alert'/'alert_error'viewmodels supports this functionality whenmessageoption hasobjecttype value. App.objByPath/App.newClassByPathis used byApp.Tplclass factories.App.ko.Grid.iocKoFilter_*methods now are orthogonal thus are easier to override.- Grid dialogs default hotkeys (
Escape,Enter). widgets.PrefillWidget- field widget to prefill form input value from bootstrap 3 dropdown menu. ListQuerySet now hasprefill_choices()method, which may provide prefill values for the form field from db field list of values..badge.btn-*CSS classes which can be used to wrap long text in bootstrap buttons.- Separate
admin.jsscript to enable client-side ofOptionalWidgetin django admin. App.ko.Gridactionsmeta/list/meta_listfirst requests passing HTTP POSTfirstLoadvariable to detect the initial grid datatable action at server-side in KoGridView derived class.- Fixed selection of all current page grid datatable rows at multiple grid datatable pages.
- plugins.js:
jQuery.id()to get multiple DOM ids,_.moveOptions()to move options with possible default values.highlightListUrljQuery function bugfixes. - tooltips.js:
form_errorviewmodel handler, used to display AJAX forms validation errors now has the diagnostic for missingauto_idvalues and better support for multiple error messages per field. - contenttypes: Create content types / user groups / user permissions / Django model migration seeds. For the example of seeds, see djk_seed Django management command.
FormWithInlineFormsetssupports form auto_id prefix and optional customizable form / formset constructor kwargs.json_validatorsmodule is renamed into validators, which implements genericViewmodelValidatorclass to validate AJAX submitted form input and to return error viewmodels when needed.DjkJSONEncoderserializes lazy strings to prevent json serialization errors.BaseSeleniumCommandslogs browser errors.- tpl module reworked and expanded. Nested lists use common class
PrintList. Implementedjson_flatatt()andformat_html_attrs()functions which work like built-in Djangoflatatt()andformat_html()but automatically convert list / dict types of arguments into html attributes and / or JSON strings. - Many bugfixes.
- Grids (datatables)
- New type of action
'pagination'.- There are two built-in actions of this type implemented:
'rows_per_page'and'switch_highlight'.
- There are two built-in actions of this type implemented:
- Support of compound columns.
glyphiconactions are rendered in the single column of datatable, instead of each action per column.
- New type of action
- Static assets are moved to '/djk' subdirectory, minimizing the risk of conflicts with third party assets.
- Updated to latest versions of Knockout.js / jQuery / Bootstrap 3 (should also work with not-too-old ones).
- viewmodels AJAX response routing is rewritten as
App.ViewModelRouterclass with default instanceApp.vmRouter. It now supports binding viewmodel handlers to Javascript class instances methods. - Optional built-in Javascript error logger.
App.NestedListinternally used byApp.renderNestedListfor greater flexibility of client-side Javascript nested lists rendering.App.NestedListnow supports ordered maps via_.ODictinstances.- Ajax forms submitting is refactored into
App.AjaxFormclass, while setting up the ajax forms is performed byApp.AjaxForms. App.readyInstancesintroduced for global client-side IoC, available in custom user scripts as well.- Knockout.js method subscription / unsubscription is placed into
App.ko.Subscribermixin class. focusbinding is implemented for Knockout.js.- Request mock-up when running without web server allows reverse resolving of FQN urls in console management commands and in background celery tasks via reverseq() calls when sites framework is correctly set up.
ast_evaltemplate tag.- Headless Chrome Selenium webdriver support.
- Supports both Bootstrap 4 and Bootstrap 3 via pluggable djk_ui application.
- Default rendering layouts for fields / forms / related forms / inline formsets, which can be customized by providing custom template or via inheriting from Renderer class.
- Underscore.js templates support template attributes merging and custom tags.
- Nested components and Sparse components.
- Nested serializer.
- Dropped Django<=1.10 support. Added Django 2.2 support.
- Dropped IE9..10 support.
- Current request
.view_titleis stored in the.resolver_match. bs_collapse()Jinja2 macro supports setting the initial collapse state ('out' / 'in') and Bootstrap card type.- Implemented
App.OrderedHooksclass used to executeApp.initClientHooksin proper order. grid.js: cleaned up init / shutdown.applyBindings()/.cleanBindings()/.runComponent()/.removeComponent()code forApp.ko.Gridand related classes.grid.js: Implemented actionmeta_listpreload.- Refactored views classes inheritance hierarchy.
- middleware: refactored middleware classes inheritance hierarchy.
- middleware: less intrusive, better compatibility with third party modules.
- middleware:
.djk_request()``_ ``.djk_view()methods are called only forDJK_APPSviews by default. - middleware :
json_response()shortcut method. RendererModelForm.has_saved_instance()method to check whether current Django ModelForm has the bound and saved instance.- ListQuerySet: implemented
|+operators. DjkJSONEncoder: moved totplmodule. Encoding improvements.- Refactored forms module to forms package with base / renderers / validators modules.
- HTTP response related classes / methods are moved to
httpmodule.
- bdist wheel fix.
- PyPi readme fix.
django-jinjadependency is off by default, may be removed in the future.TemplateContextclass is used to manage client-side data injection.- Less dependency on
DJK_MIDDLEWARE. - Templates / selenium test improvements.
- Django 3.1a1 / Bootstrap 4.5 / Knockout 3.5 support.
- MultipleKeyGridWidget allows to edit many to many relationships for Django models.
PageContextto inject view title / client data / client routes / custom scripts to templates viaTemplateResponse.App.renderValuesupports jQuery elements / nested arrays / objects / strings HTML rendering.App.renderNestedListsupports optional unwrapping of single top DOM node.- Improved Bootstrap popovers support with jQuery
.getPopoverTip()/.getVisiblePopovers()/.closeVisiblePopovers()plugins. - Support for nested components in formsets.js (empty_form) 'anonymous_template' Knockout binding.
UrlPathclass for automaticre_path()generation with positional named keyword arguments.
- Django 3.2 / Django 4.0 support.
es6 modulessupport for modern browsers.SystemJSloader support for IE11 viadjango_deno.terserbundles support both fores6 modulesand forSystemJSloader viadjango_deno.datatablessupport separate cell click actions.- Support for
datatablesannotated fields / virtual fields viagrid_fieldsdicts. - Optional lazy registration of client-side components.
- Improved related grid view kwargs auto-detection.
ListRangeFilterforListSortingViewrange fields.
- Built-in
custom elementsin es5 with IE11 polyfills. Bootstrap 5compatibility.ObjDictDjango model serializer with built-in field permissions check.get_absolute_urlwith optional user permission check.
FormFieldsRenderer/fields_templateto customizeModelFormfields layout.ListQuerySetimplemented.delete()method and most commonaggregatefunctions:Count,Min,Max,Sum.- Load
jQuery.form/Moment.js/ Bootstrap Datetimepicker ases6 modules. QueryStringwrapper forUrlSearchParams.- Bootstrap navs style of Grid filter choices:
ko_grid_navs_filter_choices. GridshowNonSortableColumnNamesoption.Gridbutton_paginationbuilt-in action type.- Nested components are supported in
Gridcells, including the cells of compound columns. Tpl.domTemplateoptional template kwargs support.djk_bootstrap5now uses nativeBootstrap Iconsfont foriconuiactions.
- Python 3.12 / Django 5.0 compatibility.
- Use axios instead of outdated jQuery.form plugin.