Metadata-Version: 1.1
Name: django-jinja-knockout
Version: 0.4.3
Summary: Django AJAX ModelForms. Read-only display ModelForms. Django AJAX grids with CRUD and custom actions. Supports Django Templates.
Home-page: https://github.com/Dmitri-Sintsov/django-jinja-knockout
Author: Dmitriy Sintsov
Author-email: questpc256@gmail.com
License: GPL-3.0
Description: =====================
        django-jinja-knockout
        =====================
        
        .. _celery: http://www.celeryproject.org/
        .. _Knockout.js: http://knockoutjs.com/
        .. _Jinja2: http://jinja.pocoo.org/docs/dev/
        .. _Bootstrap 3: http://getbootstrap.com/
        .. _django-jinja-knockout python localization: https://poeditor.com/join/project/9hqQrFEdDM
        .. _django-jinja-knockout javascript localization: https://poeditor.com/join/project/049HWzP3eb
        .. _sample application: https://github.com/Dmitri-Sintsov/djk-sample
        .. _prefetch_related(): https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.Prefetch
        
        .. image:: https://badge.fury.io/py/django-jinja-knockout.png
           :alt: PyPI package
           :target: https://badge.fury.io/py/django-jinja-knockout
        
        .. image:: https://circleci.com/gh/Dmitri-Sintsov/django-jinja-knockout.svg?style=shield
            :target: https://circleci.com/gh/Dmitri-Sintsov/django-jinja-knockout
        
        .. image:: https://img.shields.io/travis/Dmitri-Sintsov/django-jinja-knockout.svg?style=flat
            :target: https://travis-ci.org/Dmitri-Sintsov/django-jinja-knockout
        
        .. image:: https://badges.gitter.im/django-jinja-knockout/Lobby.svg
           :alt: Join the chat at https://gitter.im/django-jinja-knockout/Lobby
           :target: https://gitter.im/django-jinja-knockout/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
        
        Screenshot of `sample application`_:
        
        .. image:: https://raw.githubusercontent.com/wiki/Dmitri-Sintsov/djk-sample/djk_edit_inline.png
           :width: 740px
        
        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:
        
        * `django-jinja-knockout python localization`_
        * `django-jinja-knockout javascript localization`_
        
        Localization contributors:
        
        * Dutch: ``Melvyn Sopacua``
        * Polish: ``pawelkoston``
        
        Key features
        ------------
        
        * Django 1.8, 1.9, 1.10, 1.11 support. Python 3.4 / 3.5 / 3.6 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 usage in ``ListView`` / ``ListSortingView`` / ``KoGridView`` derived
          classes.
        * 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 %}
        
        Overview
        --------
        
        Templating languages are my favorite topic in programming. I love semantically organic way of HTML templating in
        Knockout.js that uses html5 "data-bind" JSON-like attributes instead of semantically alien double braces, which
        conflicts almost every server-side templating language out there (including Jinja2).
        
        When developing with Django, I felt a lack of very powerful server-side templating when used built-in DTL templates.
        So I switched to Jinja2, thank to Django 1.8+ built-in support of this templating engine and to great project
        https://github.com/niwinz/django-jinja
        which simplifies Jinja2 integration.
        
        So, basically in this project two great templating engines (client-side https://github.com/knockout/knockout and
        server-side https://github.com/mitsuhiko/jinja2) meet together. That allows to write complex dynamic HTML code with less
        effort, cleaner look and easily readable. Both also are very fast, Knockout.js templates being one of the fastest at
        client-side, while Jinja2 estimated to be faster few times than built-in DTL templates, and is more powerful.
        
        When thinking of Angluar.js, not only I dislike curly braces in templates but also I believe that using such large
        framework for non-SPA applications is an overkill. And Django primary usage are non-SPA classical Web applications,
        which aren't "outdated" in any way - because such applications are much better indexable by web crawlers and Python is
        better language than Javascript in general and server-side has less glitches than browsers.
        
        Most of client-side scripts included into this redistributable app are server-side agnostic and are not tied much to
        Django, except for client-side localization. In fact, significant parts of that client-side code also were used in large
        Laravel project. They are included for developer's convenience. Also my personal feeling is, that Django itself lacks
        a bit heavier support of client-side Javascript out-of-box. Knockout.js would be great inclusion for ``empty_form``
        handling and in ``django.admin``, considering it's small size.
        
        However, some of server-side functionality, like AJAX form validation and viewmodels manipulation is either useless or
        will not work without these scripts.
        
        Only AJAX response parts and DOM manipulation (eg. Knockout.js processing of ``formset.empty_form``) are tied to bundled
        client-side scripts.
        
        Major changes (version 0.4.0)
        -----------------------------
        Large improvements in Selenium testing support: additional commands are implemented, auto-retry on DOM timeout, fixtures
        loading / saving which allows to skip already debugged parts of tests, saving developer's time.
        
        ``ContextMiddleware`` supports request mocking and request-time storage.
        
        ``FilteredRawQuerySet`` supports Q expressions (Q objects) with relation mapping.
        
        ``BaseFilterView`` / ``KoGridView`` - basic support for Q expressions (currently is used for ``None`` value of field
        filter), support for ``in`` query for ``choice`` filter value via the list of values.
        
        Even better support of optional Django model ``get_str_fields()`` method in ``DisplayText`` widget and in Knockout.js
        grids.
        
        Various bugfixes.
        
        Minor changes (version 0.4.1)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Implemented ``multiple_choices``: ``True`` option of the field filter ``type`` ``choices`` in ``ListSortingView``.
        That allows to perform ``in`` field lookups for the selected field filter.
        
        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.
        
        Bugfixes and security fixes in query / views modules.
        
        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.
        
        Quick notes:
        
        .. Next links are github relative links. Do not process these via sphinx as it does not follow them correctly.
        .. _Credits: AUTHORS.rst
        .. _contribute: CONTRIBUTING.rst
        .. _History: HISTORY.rst
        .. _Installation: INSTALLATION.rst
        .. _Introduction: QUICKSTART.rst
        
        * Installation_
        * Introduction_
        * How to contribute_
        * History_
        * Credits_
        
        Cookiecutter Tools Used in Making This Package
        ----------------------------------------------
        
        *  cookiecutter
        *  cookiecutter-djangopackage
        
        
        
        
        .. _add_instance: https://github.com/Dmitri-Sintsov/djk-sample/search?utf8=%E2%9C%93&q=add_instance
        .. _bs_list.htm: https://github.com/Dmitri-Sintsov/django-jinja-knockout/blob/master/django_jinja_knockout/jinja2/bs_list.htm
        .. _dump_data: https://github.com/Dmitri-Sintsov/djk-sample/search?utf8=%E2%9C%93&q=dump_data
        .. _fixtures_order: https://github.com/Dmitri-Sintsov/djk-sample/search?utf8=%E2%9C%93&q=fixtures_order
        .. _.has_fixture(): https://github.com/Dmitri-Sintsov/djk-sample/search?utf8=%E2%9C%93&q=has_fixture
        .. _yield_out_instances: https://github.com/Dmitri-Sintsov/djk-sample/search?utf8=%E2%9C%93&q=yield_out_instances
        
        =======
        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.
        
        0.4.0
        -----
        * Improvements in testing support:
        
          * ``AutomationCommands`` now uses yield to generate the sequence of opcodes and their args, resulting in cleaner code.
          * ``SeleniumCommands`` is reworked into ``BaseSeleniumCommands``. 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 ``DjkTestCase`` derived class.
            * Automatical 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.
        
          * ``SeleniumQueryCommands`` implements generic Selenium commands, including Django reverse url support for navigation
            bar, anchors and forms, which could be useful in any Django application.
          * ``DjkSeleniumQueryCommands`` implements additional Selenium commands related to django-jinja-knockout functionality,
            such as BootstrapDialog and Knockout.js grids / widgets support.
        
        forms.py
        ~~~~~~~~
        * ``BootstrapModelForm`` always populates ``.request`` attribute for convenience.
        * ``CustomFullClean`` / ``StripWhilespaceMixin`` mixins for Django forms.
        
        middleware.py
        ~~~~~~~~~~~~~
        * ``ContextMiddleware`` class:
        
          * 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.
        
        query.py
        ~~~~~~~~
        * ``FilteredRawQuerySet`` supports Q expressions (Q objects) with relation mapping.
        
        views submodule
        ~~~~~~~~~~~~~~~
        * ``BaseFilterView``
        
          * ``filter_queryset()`` now supports args in addition to kwargs. That allows to use Django ``Q`` objects in grids
            and lists, although actual generation of ``Q`` objects is still limited to ``None`` value filtering.
          * ``None`` can be valid value of field filter query. It is mapped to ``is_null`` field lookup, also it uses Django
            ``Q.__or__`` operation in case ``None`` is presented in the list of field filter values.
          * Query filters now support ``in`` clause for drop-down ``choice`` filter.
        
        widgets.py
        ~~~~~~~~~~
        * ``DisplayText`` field widget ``__init__()`` method now supports two types of ``get_text`` callback arguments:
        
          * ``get_text_method`` which binds passed function to DisplayText widget instance (self as first argument)
          * ``get_text_fn`` which uses unbound function (no self).
        
        If form that defined widget uses ``WidgetInstancsMixin`` 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``
        modile to produce structured output.
        
        ko_grid_body.htm
        ~~~~~~~~~~~~~~~~
        *  Fixed ``ko_grid_body()`` macro not including underscore.js templates copied with different ``template_id`` when these
           templates were called from related underscore.js templates.
        
        ko-grid.js
        ~~~~~~~~~~
        * Reset filter now uses ``undefined`` value instead of ``null`` value because filtering by ``None`` value is now
          supported in ``KoGridView``.
        * ``App.ko.GridRow`` class ``toDisplayValue()`` method now automatically picks nested relation value from nested
          ``strFields`` value, when available. That allows to traverse nested ``get_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_action`` property.
        * Query filters now support multi-value ``in`` clause for values of drop-down ``choice`` filter.
        * Grid viewmodel ``deleted_pks`` key values are processed first in ``App.ko.Grid.updatePage()``. That allows to delete
          old row and add new row with the same ``pkVal`` at once (forced update).
        * ``App.ko.Grid`` class  ``.setFiltersChoices()`` method simplifies programmatic filtering of grid at client-side, for
          example from the parsed querystring.
        
        plugins.js
        ~~~~~~~~~~
        ``$.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.
        
        0.4.1
        -----
        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.
        
        0.4.2
        -----
        * Compatibility to 1.10+ new-style middleware (thanks to Melvyn Sopacua).
        * Fixed pagination when multiple filter field choices are seiected in views.ListSortingView.
        
        0.4.3
        -----
        * Django 1.11 / Python 3.6 support.
        * Selenium testing commands fixes.
Keywords: django,jinja,knockout.js,ajax,forms,grid,datagrid,datatables
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
