{ "info": { "author": "Pavel Zhukov", "author_email": "gelios@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Programming Language :: Python" ], "description": "django-extra-views-ng - The missing class-based generic views for Django\r\n========================================================================\r\n\r\nDjango's class-based generic views are great, they let you accomplish a large number of web application design patterns in relatively few lines of code. They do have their limits though, and that's what this library of views aims to overcome.\r\n\r\nInstallation\r\n------------\r\n\r\nInstalling from pypi (using pip). ::\r\n\r\n pip install django-extra-views-ng\r\n\r\nInstalling from github. ::\r\n\r\n pip install -e git://github.com/hovel/django-extra-views.git#egg=django-extra-views\r\n\r\n\r\nFeatures so far\r\n------------------\r\n\r\n- FormSet and ModelFormSet views - The formset equivalents of FormView and ModelFormView.\r\n- InlineFormSetView - Lets you edit formsets related to a model (uses inlineformset_factory)\r\n- CreateWithInlinesView and UpdateWithInlinesView - Lets you edit a model and its relations\r\n- GenericInlineFormSetView, the equivalent of InlineFormSetView but for GenericForeignKeys\r\n- Support for generic inlines in CreateWithInlinesView and UpdateWithInlinesView\r\n- Support for naming each inline or formset with NamedFormsetsMixin\r\n- SortableListMixin - Generic mixin for sorting functionality in your views\r\n- SearchableListMixin - Generic mixin for search functionality in your views\r\n\r\nStill to do\r\n-----------\r\n\r\nI'd like to add support for pagination in ModelFormSetView and its derivatives, the goal being to be able to mimic the change_list view in Django's admin. Currently this is proving difficult because of how Django's MultipleObjectMixin handles pagination.\r\n\r\nExamples\r\n--------\r\n\r\nDefining a FormSetView. ::\r\n\r\n from extra_views import FormSetView\r\n\r\n\r\n class AddressFormSet(FormSetView):\r\n form_class = AddressForm\r\n template_name = 'address_formset.html'\r\n\r\nDefining a ModelFormSetView. ::\r\n\r\n from extra_views import ModelFormSetView:\r\n\r\n\r\n class ItemFormSetView(ModelFormSetView):\r\n model = Item\r\n template_name = 'item_formset.html'\r\n\r\nDefining a CreateWithInlinesView and an UpdateWithInlinesView. ::\r\n\r\n from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSet\r\n from extra_views.generic import GenericInlineFormSet\r\n\r\n\r\n class ItemInline(InlineFormSet):\r\n model = Item\r\n\r\n\r\n class TagInline(GenericInlineFormSet):\r\n model = Tag\r\n\r\n\r\n class CreateOrderView(CreateWithInlinesView):\r\n model = Order\r\n inlines = [ItemInline, TagInline]\r\n\r\n\r\n class UpdateOrderView(UpdateWithInlinesView):\r\n model = Order\r\n inlines = [ItemInline, TagInline]\r\n\r\n\r\n # Example URLs.\r\n urlpatterns = patterns('',\r\n url(r'^orders/new/$', CreateOrderView.as_view()),\r\n url(r'^orders/(?P\\d+)/$', UpdateOrderView.as_view()),\r\n )\r\n\r\nIf you want to use granular access in templates you can name your inlines or formsets with NamedFormsetsMixin. ::\r\n\r\n from extra_views import NamedFormsetsMixin\r\n\r\n class CreateOrderView(CreateWithInlinesView):\r\n model = Order\r\n inlines = [ItemInline, TagInline]\r\n inlines_names = ['Items', 'Tags']\r\n\r\nYou can add search ability for your classes by adding SearchableMixin and by setting search_fields::\r\n\r\n from django.views.generic import ListView\r\n from extra_views import SearchableListMixin\r\n\r\n class SearchableItemListView(SearchableListMixin, ListView):\r\n template_name = 'extra_views/item_list.html'\r\n search_fields = ['name', 'sku']\r\n model = Item\r\n\r\nIn this case ``object_list`` will be filtred if GET query will be provided (like /searchable/?q=query), or you\r\ncan manually override get_search_query method, to build custom search query\r\n\r\nAlso you can define some items in ``search_fields`` as tuple (e.g. ``[('name', 'iexact', ), 'sku']``)\r\nto provide custom lookups for searching. Default lookup is ``icontains``. We strongly recommend to use only\r\nstring lookups, when number fields will convert to strings before comparison to prevent converting errors.\r\nThis controlled by ``check_lookups`` setting of SearchableMixin.\r\n\r\nDefine sorting in view. ::\r\n\r\n from django.views.generic import ListView\r\n from extra_views import SortableListMixin\r\n\r\n class SortableItemListView(SortableListMixin, ListView):\r\n sort_fields_aliases = [('name', 'by_name'), ('id', 'by_id'), ]\r\n model = Item\r\n\r\nYou can hide real field names in query string by define sort_fields_aliases attribute (see example)\r\nor show they as is by define sort_fields. SortableListMixin adds ``sort_helper`` variable of SortHelper class,\r\nthen in template you can use helper functions: ``{{ sort_helper.get_order_query_by_FOO }}``,\r\n``{{ sort_helper.get_order_query_by_FOO_asc }}``, ``{{ sort_helper.get_order_query_by_FOO_desc }}`` and\r\n``{{ sort_helper.is_sorted_by_FOO }}``\r\n\r\nMore descriptive examples to come.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hovel/django-extra-views", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-extra-views-ng", "package_url": "https://pypi.org/project/django-extra-views-ng/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-extra-views-ng/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hovel/django-extra-views" }, "release_url": "https://pypi.org/project/django-extra-views-ng/0.3.3/", "requires_dist": null, "requires_python": null, "summary": "Extra class-based views for Django", "version": "0.3.3" }, "last_serial": 789592, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "74f668854093aa2ce602d77677237da8", "sha256": "c348098d4068e144efd4c1298e947d77f71ec9f5bb96da046ff837a773e56272" }, "downloads": -1, "filename": "django-extra-views-ng-0.3.0.tar.gz", "has_sig": false, "md5_digest": "74f668854093aa2ce602d77677237da8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11106, "upload_time": "2012-09-17T12:25:01", "url": "https://files.pythonhosted.org/packages/2e/53/65e68cdf599ad0db3d48302ceb763dc9ffbe866a3a5b360fa93490346c32/django-extra-views-ng-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "64a633ab38421369f7f5f76e032ebd0b", "sha256": "fc8272f340692316bd9d4a4c5745d4022a8830894877065224d11ceb913e0263" }, "downloads": -1, "filename": "django-extra-views-ng-0.3.1.tar.gz", "has_sig": false, "md5_digest": "64a633ab38421369f7f5f76e032ebd0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11102, "upload_time": "2012-09-17T12:47:15", "url": "https://files.pythonhosted.org/packages/57/99/3644c6030ee79b560caf8836e1c4e18a106e5789d4f0a36b80dd3d734be8/django-extra-views-ng-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "934e74d83cf28cdd262dbc4bc48da236", "sha256": "76c949b4c628d70973b6345c3f0956a9511281e7780f77f4dd4950a79c311116" }, "downloads": -1, "filename": "django-extra-views-ng-0.3.2.tar.gz", "has_sig": false, "md5_digest": "934e74d83cf28cdd262dbc4bc48da236", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11388, "upload_time": "2012-09-18T18:42:32", "url": "https://files.pythonhosted.org/packages/ef/62/38c419d995a09cc0b116b7d5e8e1d688e7cb648e22a30859fde9bebcee76/django-extra-views-ng-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "0df6f5599ee5770a25c4c22335124599", "sha256": "cf7d29f05950b4a95873064a9d48663ab68963c9fea6471a726dac19e603bc27" }, "downloads": -1, "filename": "django-extra-views-ng-0.3.3.tar.gz", "has_sig": false, "md5_digest": "0df6f5599ee5770a25c4c22335124599", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11741, "upload_time": "2012-09-18T20:47:25", "url": "https://files.pythonhosted.org/packages/07/ae/b39857ab59f5d75fb0b9ba6822a2b0ecf0656ed1473c1efbc2452b30313a/django-extra-views-ng-0.3.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0df6f5599ee5770a25c4c22335124599", "sha256": "cf7d29f05950b4a95873064a9d48663ab68963c9fea6471a726dac19e603bc27" }, "downloads": -1, "filename": "django-extra-views-ng-0.3.3.tar.gz", "has_sig": false, "md5_digest": "0df6f5599ee5770a25c4c22335124599", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11741, "upload_time": "2012-09-18T20:47:25", "url": "https://files.pythonhosted.org/packages/07/ae/b39857ab59f5d75fb0b9ba6822a2b0ecf0656ed1473c1efbc2452b30313a/django-extra-views-ng-0.3.3.tar.gz" } ] }