django-popupcrud


Namedjango-popupcrud JSON
Version 0.6.4 PyPI version JSON
download
home_pagehttps://github.com/harikvpy/django-popupcrud
SummaryA CRUD framework that uses HTML popups for CRUD operations.
upload_time2018-03-26 02:41:21
maintainer
docs_urlNone
authorHari Mahadevan
requires_python
licenseBSD 3-Clause License
keywords django-popupcrud
VCS
bugtrack_url
requirements Django django-bootstrap3 django-pure-pagination pylint-django sphinx twine
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ================
django-popupcrud
================

A CRUD framework leveraging Django's generic views that implements CRUD 
operations through HTML popups.

.. image:: https://img.shields.io/pypi/v/django-popupcrud.svg
    :target: https://pypi.python.org/pypi/django-popupcrud
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/dm/django-popupcrud.svg
    :target: https://pypi.python.org/pypi/django-popupcrud
    :alt: Number of PyPI downloads per month

Requirements
------------

- Python 2.7, 3.4
- Django >= 1.9
- `django-bootstrap3 <https://github.com/dyve/django-bootstrap3.git>`_
- `django-pure-pagination <https://github.com/jamespacileo/django-pure-pagination.git>`_

Documentation
-------------

Available at `django-popupcrud.readthedocs.io 
<http://django-popupcrud.readthedocs.io/en/latest/index.html>`_.

Quickstart
----------

1. Install ``django-popupcrud`` using pip: 

   ``pip install django-popucrud``
   
   Or install it directly from the source repository:
   
   ``pip intall git+https://github.com/harikvpy/django-popupcrud.git``

   Yet another way would be to clone this repository and install from the cloned 
   root folder via ``pip install -e .``.

2. Install the dependencies - ``django-bootstrap3`` and 
   ``django-pure-pagination``.  Add the dependencies and ``popupcrud`` to 
   ``INSTALLED_APPS`` in your project's ``settings.py``::

       INSTALLED_APPS = [
           ...
           'bootstrap3',
           'pure_pagination',
           'popupcrud',
           ...
       ]

3. Let ``PopupCrudViewSet`` know of your base template file name. This defaults 
   to ``base.html``, but if your project uses a different base template 
   filename, inform ``PopupCrudViewSet`` about it in ``settings.py``::

        POPUPCRUD = {
            'base_template': 'mybase.html',
        }

   Include Bootstrap CSS & JS resources in this base template.
   If you were to use ``django-bootstrap3`` tags for these, your base 
   template should look something like this::

    <head>
        {% bootstrap_css %}
        <script src="{% bootstrap_jquery_url %}" type="text/javascript" charset="utf-8"></script>
        {% bootstrap_javascript %}
        {% block extrahead %}{% endblock extrahead %}
    </head>

   Also, define a block named ``extrahead`` within the ``<head>`` element.
   ``PopupCrudViewSet`` views use a few custom CSS styles to show column 
   sorting options and sort priority. These styles are defined in 
   ``static/popupcrud/css/popupcrud.css`` which is inserted into 
   the ``extrahead`` block. If you don't declare this block,
   you will have to explicitly load the stylesheet into your base template.

4. In your app's ``views.py``, create a ``ViewSet`` for each model for which you
   want to support CRUD operations.

   Models.py::

    from django.db import models

    class Author(models.Model):
        name = models.CharField("Name", max_length=128)
        penname = models.CharField("Pen Name", max_length=128)
        age = models.SmallIntegerField("Age", null=True, blank=True)

        class Meta:
            ordering = ('name',)
            verbose_name = "Author"
            verbose_name_plural = "Authors"

        def __str__(self):
            return self.name

   Views.py::

    from popupcrud.views import PopupCrudViewSet

    class AuthorViewSet(PopupCrudViewSet):
        model = Author
        fields = ('name', 'penname', 'age')
        list_display = ('name', 'penname', 'age')
        list_url = reverse_lazy("library:authors:list")
        new_url = reverse_lazy("library:authors:create")

        def get_edit_url(self, obj):
            return reverse_lazy("library:authors:update", kwargs={'pk': obj.pk})

        def get_delete_url(self, obj):
            return reverse_lazy("library:authors:delete", kwargs={'pk': obj.pk})

5. Wire up the CRUD views generated by the viewset to the URLconf::

        urlpatterns= [
            url(r'^authors/', views.AuthorCrudViewset.urls()),
        ]

   This will register the following urls:

    * ``authors/`` - list view
    * ``authors/create/`` - create view
    * ``authors/<pk>/`` - detail view
    * ``authors/<pk>/update/`` - update view
    * ``authors/<pk>/delete/`` - delete view

   The urls are registered under its own namespace, which defaults to the 
   model's ``verbose_name_plural`` meta value.

6. Thats it! Your modern HTML popup based CRUD for your table is up and running.

   PopupCrudViewSet has many options to customize the fields displayed in list
   view, form used for create/update operations, permission control and more.
   Refer to the Reference and How-to sections of the documentation for more
   details.

License
-------
Distributed under BSD 3-Clause License. See `LICENSE 
<LICENSE>`_ file for details.


History
-------

0.1.0 (2017-09-25)
++++++++++++++++++

* Initial release

0.1.2 (2017-09-26)
++++++++++++++++++

* Merge Quickstart section into README

0.1.3 (2017-09-26)
++++++++++++++++++

* Add missing HISTORY.rst to manifst

0.1.4 (2017-09-26)
++++++++++++++++++

* Support for ``order_field`` attribute for ``list_display`` method fields.
  This works similar to ``ModelAdmin`` method fields' ``admin_order_field``
  property.

0.1.5 (2017-09-26)
++++++++++++++++++

* Better unicode support

0.1.6 (2017-09-27)
++++++++++++++++++

* Better access control support through 'login_url' & 'raise_exception'
  PopupCrudViewSet properties

0.1.7 (2017-10-13)
++++++++++++++++++

* Object detail view support

0.1.8 (2017-10-16)
++++++++++++++++++

* Add PopupCrudViewSet.urls() -- a single method to return all the CRUD urls
  that can be added to urlpatterns[].
* When related object popup is activated on a multiselect select and it adds a
  new object, the object is added to the existing list of selections. (old code
  used to replace all the current selections with the newly added item)
* Insert all form media into ListView through ListView.media property.
* Fix broken support for django-select2 in modals by setting control's
  dropdownParent to the modal (rather than parent window)
* Use the 'create-edit-modal' modal as the template for secondary modals
  activated through related-model modal popups. This ensures consistent modal
  look and feel if the user customized the modal template by overriding
  popupcrud/modal.html template.
* Fix ALLOWED_HOSTS in settings - issue #1

0.2.0 (2017-10-18)
++++++++++++++++++
* Bumping minor version as reflection of new features legacy_crud dict, media
  & out-of-the-box django_select2 support in previous release
* Added 'crudform.ready' JavaScript event, which is triggered when
  create/update form is activated. This event provides clients an uniform way to
  apply their own optional initialization code to the CRUD forms.
* Added 6 more tests to cover new legacy_crud dict value support & form media
  injection.

0.3.0 (2017-10-26)
++++++++++++++++++
* List view content is rendered in its own block, popupcrud_list, in the
  template file. This allows the list content to be relocated to different
  parts of the base template.
* Add ViewSet.empty_list_icon and ViewSet.empty_list_message properties. These
  properties provide for prettier rendering of empty table states.

0.3.1 (2017-10-26)
++++++++++++++++++
* Use custom style for empty-list-state icon sizing. Earlier code was using font
  awesome style.

0.4.0 (2017-11-2)
+++++++++++++++++
* Breadcrumbs support
* ListView queryset custom filtering through ``PopupCrudViewSet.get_queryset()``
* Support custom form init args through ``PopupCrudViewSet.get_form_kwargs()``
* ``PopupCrudViewSet.new_url`` and ``PopupCrudViewSet.list_url`` are determined
  through ``PopupCrudViewSet.get_new_url()`` and
  ``PopupCrudViewSet.get_list_url()`` throughout the code.

0.4.1 (2017-11-6)
+++++++++++++++++
* Fix an issue where when form with errors is rendered select2 and add-related
  widgets are not bound correctly

0.5.0 (2017-11-10)
++++++++++++++++++
* Add custom item action support
* Clean up JavaScript by encapsulating all methods in its own namespace &
  reducing code duplication
* Add missing CSS styles to popupcrud.css
* Empty_list_message class variable now allows embedded html tags (value is
  wrapped in mark_safe() before placing in template context)

0.6.0 (2018-03-15)
++++++++++++++++++
* Add formset support in CRUD create/update views
* Add size option to bsmodal template tags
* Fixes to some minor bugs

0.6.1 (2018-03-16)
++++++++++++++++++
* Make formset alignment consistent with bootstrap3 settings
  horizontal_label_class & horizontal_field_class.

0.6.2 (2018-03-17)
++++++++++++++++++
* Fix bug where forms with m2m fields were not saved
* Reflect formset form field 'required' status in field column header
* Make formsets work in legacy crud mode
* django-select2 support in formset forms
* Minor formset layout formatting improvements

0.6.3 (2018-03-18)
++++++++++++++++++
* Fix incorrect formset detection logic

0.6.4 (2018-03-26)
++++++++++++++++++
* Optimize listview media when create & edit are set to legacy
* Breadcrumbs obeys custom page title
* Fix bug in ListView.media optimization
* Introduce permissions_required attribute
* PopupCrudViewSet.get_page_title now used in for all CRUD(legacy) views
            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "django-popupcrud", 
    "upload_time": "2018-03-26 02:41:21", 
    "requirements": [
        {
            "name": "Django", 
            "specs": [
                [
                    ">=", 
                    "1.9"
                ]
            ]
        }, 
        {
            "name": "django-bootstrap3", 
            "specs": [
                [
                    "==", 
                    "9.0.0"
                ]
            ]
        }, 
        {
            "name": "django-pure-pagination", 
            "specs": [
                [
                    "==", 
                    "0.3.0"
                ]
            ]
        }, 
        {
            "name": "pylint-django", 
            "specs": []
        }, 
        {
            "name": "sphinx", 
            "specs": []
        }, 
        {
            "name": "twine", 
            "specs": []
        }
    ], 
    "author": "Hari Mahadevan", 
    "home_page": "https://github.com/harikvpy/django-popupcrud", 
    "github_user": "harikvpy", 
    "download_url": "https://pypi.python.org/packages/77/5f/ff6f7256d9d8a564db032c826d1521471d7cb6dc43c74c69a3e74d6df6f3/django-popupcrud-0.6.4.tar.gz", 
    "platform": "", 
    "version": "0.6.4", 
    "cheesecake_documentation_id": null, 
    "description": "================\ndjango-popupcrud\n================\n\nA CRUD framework leveraging Django's generic views that implements CRUD \noperations through HTML popups.\n\n.. image:: https://img.shields.io/pypi/v/django-popupcrud.svg\n    :target: https://pypi.python.org/pypi/django-popupcrud\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/dm/django-popupcrud.svg\n    :target: https://pypi.python.org/pypi/django-popupcrud\n    :alt: Number of PyPI downloads per month\n\nRequirements\n------------\n\n- Python 2.7, 3.4\n- Django >= 1.9\n- `django-bootstrap3 <https://github.com/dyve/django-bootstrap3.git>`_\n- `django-pure-pagination <https://github.com/jamespacileo/django-pure-pagination.git>`_\n\nDocumentation\n-------------\n\nAvailable at `django-popupcrud.readthedocs.io \n<http://django-popupcrud.readthedocs.io/en/latest/index.html>`_.\n\nQuickstart\n----------\n\n1. Install ``django-popupcrud`` using pip: \n\n   ``pip install django-popucrud``\n   \n   Or install it directly from the source repository:\n   \n   ``pip intall git+https://github.com/harikvpy/django-popupcrud.git``\n\n   Yet another way would be to clone this repository and install from the cloned \n   root folder via ``pip install -e .``.\n\n2. Install the dependencies - ``django-bootstrap3`` and \n   ``django-pure-pagination``.  Add the dependencies and ``popupcrud`` to \n   ``INSTALLED_APPS`` in your project's ``settings.py``::\n\n       INSTALLED_APPS = [\n           ...\n           'bootstrap3',\n           'pure_pagination',\n           'popupcrud',\n           ...\n       ]\n\n3. Let ``PopupCrudViewSet`` know of your base template file name. This defaults \n   to ``base.html``, but if your project uses a different base template \n   filename, inform ``PopupCrudViewSet`` about it in ``settings.py``::\n\n        POPUPCRUD = {\n            'base_template': 'mybase.html',\n        }\n\n   Include Bootstrap CSS & JS resources in this base template.\n   If you were to use ``django-bootstrap3`` tags for these, your base \n   template should look something like this::\n\n    <head>\n        {% bootstrap_css %}\n        <script src=\"{% bootstrap_jquery_url %}\" type=\"text/javascript\" charset=\"utf-8\"></script>\n        {% bootstrap_javascript %}\n        {% block extrahead %}{% endblock extrahead %}\n    </head>\n\n   Also, define a block named ``extrahead`` within the ``<head>`` element.\n   ``PopupCrudViewSet`` views use a few custom CSS styles to show column \n   sorting options and sort priority. These styles are defined in \n   ``static/popupcrud/css/popupcrud.css`` which is inserted into \n   the ``extrahead`` block. If you don't declare this block,\n   you will have to explicitly load the stylesheet into your base template.\n\n4. In your app's ``views.py``, create a ``ViewSet`` for each model for which you\n   want to support CRUD operations.\n\n   Models.py::\n\n    from django.db import models\n\n    class Author(models.Model):\n        name = models.CharField(\"Name\", max_length=128)\n        penname = models.CharField(\"Pen Name\", max_length=128)\n        age = models.SmallIntegerField(\"Age\", null=True, blank=True)\n\n        class Meta:\n            ordering = ('name',)\n            verbose_name = \"Author\"\n            verbose_name_plural = \"Authors\"\n\n        def __str__(self):\n            return self.name\n\n   Views.py::\n\n    from popupcrud.views import PopupCrudViewSet\n\n    class AuthorViewSet(PopupCrudViewSet):\n        model = Author\n        fields = ('name', 'penname', 'age')\n        list_display = ('name', 'penname', 'age')\n        list_url = reverse_lazy(\"library:authors:list\")\n        new_url = reverse_lazy(\"library:authors:create\")\n\n        def get_edit_url(self, obj):\n            return reverse_lazy(\"library:authors:update\", kwargs={'pk': obj.pk})\n\n        def get_delete_url(self, obj):\n            return reverse_lazy(\"library:authors:delete\", kwargs={'pk': obj.pk})\n\n5. Wire up the CRUD views generated by the viewset to the URLconf::\n\n        urlpatterns= [\n            url(r'^authors/', views.AuthorCrudViewset.urls()),\n        ]\n\n   This will register the following urls:\n\n    * ``authors/`` - list view\n    * ``authors/create/`` - create view\n    * ``authors/<pk>/`` - detail view\n    * ``authors/<pk>/update/`` - update view\n    * ``authors/<pk>/delete/`` - delete view\n\n   The urls are registered under its own namespace, which defaults to the \n   model's ``verbose_name_plural`` meta value.\n\n6. Thats it! Your modern HTML popup based CRUD for your table is up and running.\n\n   PopupCrudViewSet has many options to customize the fields displayed in list\n   view, form used for create/update operations, permission control and more.\n   Refer to the Reference and How-to sections of the documentation for more\n   details.\n\nLicense\n-------\nDistributed under BSD 3-Clause License. See `LICENSE \n<LICENSE>`_ file for details.\n\n\nHistory\n-------\n\n0.1.0 (2017-09-25)\n++++++++++++++++++\n\n* Initial release\n\n0.1.2 (2017-09-26)\n++++++++++++++++++\n\n* Merge Quickstart section into README\n\n0.1.3 (2017-09-26)\n++++++++++++++++++\n\n* Add missing HISTORY.rst to manifst\n\n0.1.4 (2017-09-26)\n++++++++++++++++++\n\n* Support for ``order_field`` attribute for ``list_display`` method fields.\n  This works similar to ``ModelAdmin`` method fields' ``admin_order_field``\n  property.\n\n0.1.5 (2017-09-26)\n++++++++++++++++++\n\n* Better unicode support\n\n0.1.6 (2017-09-27)\n++++++++++++++++++\n\n* Better access control support through 'login_url' & 'raise_exception'\n  PopupCrudViewSet properties\n\n0.1.7 (2017-10-13)\n++++++++++++++++++\n\n* Object detail view support\n\n0.1.8 (2017-10-16)\n++++++++++++++++++\n\n* Add PopupCrudViewSet.urls() -- a single method to return all the CRUD urls\n  that can be added to urlpatterns[].\n* When related object popup is activated on a multiselect select and it adds a\n  new object, the object is added to the existing list of selections. (old code\n  used to replace all the current selections with the newly added item)\n* Insert all form media into ListView through ListView.media property.\n* Fix broken support for django-select2 in modals by setting control's\n  dropdownParent to the modal (rather than parent window)\n* Use the 'create-edit-modal' modal as the template for secondary modals\n  activated through related-model modal popups. This ensures consistent modal\n  look and feel if the user customized the modal template by overriding\n  popupcrud/modal.html template.\n* Fix ALLOWED_HOSTS in settings - issue #1\n\n0.2.0 (2017-10-18)\n++++++++++++++++++\n* Bumping minor version as reflection of new features legacy_crud dict, media\n  & out-of-the-box django_select2 support in previous release\n* Added 'crudform.ready' JavaScript event, which is triggered when\n  create/update form is activated. This event provides clients an uniform way to\n  apply their own optional initialization code to the CRUD forms.\n* Added 6 more tests to cover new legacy_crud dict value support & form media\n  injection.\n\n0.3.0 (2017-10-26)\n++++++++++++++++++\n* List view content is rendered in its own block, popupcrud_list, in the\n  template file. This allows the list content to be relocated to different\n  parts of the base template.\n* Add ViewSet.empty_list_icon and ViewSet.empty_list_message properties. These\n  properties provide for prettier rendering of empty table states.\n\n0.3.1 (2017-10-26)\n++++++++++++++++++\n* Use custom style for empty-list-state icon sizing. Earlier code was using font\n  awesome style.\n\n0.4.0 (2017-11-2)\n+++++++++++++++++\n* Breadcrumbs support\n* ListView queryset custom filtering through ``PopupCrudViewSet.get_queryset()``\n* Support custom form init args through ``PopupCrudViewSet.get_form_kwargs()``\n* ``PopupCrudViewSet.new_url`` and ``PopupCrudViewSet.list_url`` are determined\n  through ``PopupCrudViewSet.get_new_url()`` and\n  ``PopupCrudViewSet.get_list_url()`` throughout the code.\n\n0.4.1 (2017-11-6)\n+++++++++++++++++\n* Fix an issue where when form with errors is rendered select2 and add-related\n  widgets are not bound correctly\n\n0.5.0 (2017-11-10)\n++++++++++++++++++\n* Add custom item action support\n* Clean up JavaScript by encapsulating all methods in its own namespace &\n  reducing code duplication\n* Add missing CSS styles to popupcrud.css\n* Empty_list_message class variable now allows embedded html tags (value is\n  wrapped in mark_safe() before placing in template context)\n\n0.6.0 (2018-03-15)\n++++++++++++++++++\n* Add formset support in CRUD create/update views\n* Add size option to bsmodal template tags\n* Fixes to some minor bugs\n\n0.6.1 (2018-03-16)\n++++++++++++++++++\n* Make formset alignment consistent with bootstrap3 settings\n  horizontal_label_class & horizontal_field_class.\n\n0.6.2 (2018-03-17)\n++++++++++++++++++\n* Fix bug where forms with m2m fields were not saved\n* Reflect formset form field 'required' status in field column header\n* Make formsets work in legacy crud mode\n* django-select2 support in formset forms\n* Minor formset layout formatting improvements\n\n0.6.3 (2018-03-18)\n++++++++++++++++++\n* Fix incorrect formset detection logic\n\n0.6.4 (2018-03-26)\n++++++++++++++++++\n* Optimize listview media when create & edit are set to legacy\n* Breadcrumbs obeys custom page title\n* Fix bug in ListView.media optimization\n* Introduce permissions_required attribute\n* PopupCrudViewSet.get_page_title now used in for all CRUD(legacy) views", 
    "tox": true, 
    "lcname": "django-popupcrud", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "django-popupcrud", 
    "license": "BSD 3-Clause License", 
    "travis_ci": false, 
    "github_project": "django-popupcrud", 
    "summary": "A CRUD framework that uses HTML popups for CRUD operations.", 
    "split_keywords": [
        "django-popupcrud"
    ], 
    "author_email": "hari@smallpearl.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2018-03-26T02:41:21", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/77/5f/ff6f7256d9d8a564db032c826d1521471d7cb6dc43c74c69a3e74d6df6f3/django-popupcrud-0.6.4.tar.gz", 
            "md5_digest": "8e495d6acdc9fea9b8cdb02202a76a02", 
            "downloads": 0, 
            "filename": "django-popupcrud-0.6.4.tar.gz", 
            "packagetype": "sdist", 
            "path": "77/5f/ff6f7256d9d8a564db032c826d1521471d7cb6dc43c74c69a3e74d6df6f3/django-popupcrud-0.6.4.tar.gz", 
            "digests": {
                "sha256": "9314368336562518a2253fff7367e11fa841b553d2195b4815016793dcfb2391", 
                "md5": "8e495d6acdc9fea9b8cdb02202a76a02"
            }, 
            "sha256_digest": "9314368336562518a2253fff7367e11fa841b553d2195b4815016793dcfb2391", 
            "size": 42475
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}