{ "info": { "author": "michaelb", "author_email": "michaelpb@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Framework :: Django :: 1.10", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Natural Language :: English", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only" ], "description": "=============================\nDjango DjangoViewHiearchy\n=============================\n\n.. image:: https://img.shields.io/pypi/v/django_view_hierarchy.svg\n :target: https://pypi.python.org/pypi/django_view_hierarchy/\n\n.. image:: https://travis-ci.org/michaelpb/django_view_hierarchy.svg?branch=master\n :target: https://travis-ci.org/michaelpb/django_view_hierarchy\n\n.. image:: https://codecov.io/gh/michaelpb/django_view_hierarchy/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/michaelpb/django_view_hierarchy\n\n* **WIP:** This app is still being developed and documented!\n\n* **NOTE:** Presently *only* supports Python 3.5+ and Django 1.9+ (see `issue\n #1 `_)\n\nHierarchical view system for Python Django.\n\nDefine an arbitrary hierarchical URL structure in your ``urls.py``, define\nhow breadcrumbs get generated for each view, and then this package will\nautomatically generate an ``urlpatterns`` list and breadcrumbs attached to\nthe request object that can be easily rendered in any page, to easily link\n\"up\" the view hierarchy.\n\nFeatures\n------------\n\n* Supports both Class Based Views and simple functional views\n\n* Auto-generates an ``urlpatterns`` for any nested URL pattern, keeping\n your ``urlpatterns`` more DRY instead of repeating common URL pattern\n elements\n\n* Automatically generates breadcrumbs with both title and URL available as\n ``request.breadcrumbs`` for each node in ancestor tree\n\n* Simple Python package: No configuration changes needed\n\nQuick start\n------------\n\n**Overview:**\n\n1. Install django_view_hierarchy and put in requirements file\n2. Using decorators or mixins, enhance some views to be \"breadcrumb aware\"\n3. Create a view hierarchy in an urlpatterns including these views\n\n---------------\n\n1. Install\n~~~~~~~~~~\n\n.. code-block:: bash\n\n pip install django_view_hierarchy\n\n\n2. Use decorator or mixin to add view hierarchy to views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFor Class Based Views, do the following:\n\n.. code-block:: python\n\n from django.views import View\n from django_view_hierarchy.views import BreadcrumbMixin\n\n class UserList(BreadcrumbMixin, View):\n breadcrumb = 'All users' # Static\n\nFor more complicated examples, you may need to specify a breadcrumb that\ninvolves fetching data from the DB or giving your view a name:\n\n.. code-block:: python\n class UserDetailView(BreadcrumbMixin, View):\n view_name = 'user_details' # Optionally give view a name\n def get_breadcrumb(self):\n pk = self.kwargs['pk']\n user = User.objects.get(pk=pk)\n return user.username\n\nFor function-style views, you can do the same thing as follows:\n\n.. code-block:: python\n from django_view_hierarchy.decorators import breadcrumb\n\n @breadcrumb('Users')\n def user_list_view(request):\n return render_to_response('...')\n\n @breadcrumb(lambda request, pk: User.objects.get(pk).username, 'user_details')\n def user_detail_view(request, pk):\n return render_to_response('...')\n\n\n3. Configure hierarchy in urls.py\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFor example, to make a set of views like:\n\n* ``/users/`` for a list of all users\n* ``/users//`` for a particular user\n* ``/users//followers/`` for a sub-page of a particular user,\n showing off their followers\n\nThe hierarchy can be built like:\n\n.. code-block:: python\n from django_view_hierarchy.helpers import view_hierarchy\n urlpatterns = view_hierarchy({\n 'users': {\n '': UserListView,\n '(?P\\d+)': {\n '': UserDetailView,\n 'followers': user_followers_view,\n },\n },\n })\n\nNote that Class Based Views *should not* include `as_view`, this will be\ndone automatically.\n\n\n5. Use breadcrumbs in views and/or templates\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n.. code-block:: html\n\n \n\n\nCredits\n-------\n\nTools used in creating this package:\n\n* Cookiecutter_\n* `cookiecutter-djangopackage`_\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n\n\nHistory\n-------\n\n0.1.0 (2017-11-10)\n++++++++++++++++++\n\n* First release on PyPI.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/michaelpb/django-view-hierarchy", "keywords": "django_view_hierarchy", "license": "GNU General Public License v3 or later (GPLv3+)", "maintainer": "", "maintainer_email": "", "name": "django_view_hierarchy", "package_url": "https://pypi.org/project/django_view_hierarchy/", "platform": "", "project_url": "https://pypi.org/project/django_view_hierarchy/", "project_urls": { "Homepage": "https://github.com/michaelpb/django-view-hierarchy" }, "release_url": "https://pypi.org/project/django_view_hierarchy/0.1.5/", "requires_dist": null, "requires_python": "", "summary": "Hierarchical view system Python Django with breadcrumbs", "version": "0.1.5" }, "last_serial": 3373002, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "1e0db9172cf928b8fbed087fe972b70d", "sha256": "e2b769cab167d15b37d0902deaae547422c69c7da1db403d54bc0846c3fa002e" }, "downloads": -1, "filename": "django_view_hierarchy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1e0db9172cf928b8fbed087fe972b70d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20648, "upload_time": "2017-11-22T01:02:24", "url": "https://files.pythonhosted.org/packages/66/1e/7e3ced0bd6b7627921ac4c009cf137faaaabb0971da5207cbefbf9911629/django_view_hierarchy-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "bc9e866837b7ee7087439172bd2e9fb3", "sha256": "768aab438a35b9d82712df602fd82f38cf9ac922f37ee75f247722684d8873e7" }, "downloads": -1, "filename": "django_view_hierarchy-0.1.3.tar.gz", "has_sig": false, "md5_digest": "bc9e866837b7ee7087439172bd2e9fb3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20643, "upload_time": "2017-11-22T23:03:09", "url": "https://files.pythonhosted.org/packages/ea/c9/dd034de8e617a4154a03a477c63474839609de5550c941ff0eeeda54a5df/django_view_hierarchy-0.1.3.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "a2d059eafe265ef17a6c33bf0b7396cc", "sha256": "1e65d3274998bdf35c32739eaabab93c432b578f1c1b5beb8c57bdca6b72aa60" }, "downloads": -1, "filename": "django_view_hierarchy-0.1.5.tar.gz", "has_sig": false, "md5_digest": "a2d059eafe265ef17a6c33bf0b7396cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20905, "upload_time": "2017-11-29T02:18:48", "url": "https://files.pythonhosted.org/packages/b7/6d/3fe0c98888b6b7e0d60302a596890d5f6cc24a0171ec8336f422f8c081ba/django_view_hierarchy-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a2d059eafe265ef17a6c33bf0b7396cc", "sha256": "1e65d3274998bdf35c32739eaabab93c432b578f1c1b5beb8c57bdca6b72aa60" }, "downloads": -1, "filename": "django_view_hierarchy-0.1.5.tar.gz", "has_sig": false, "md5_digest": "a2d059eafe265ef17a6c33bf0b7396cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20905, "upload_time": "2017-11-29T02:18:48", "url": "https://files.pythonhosted.org/packages/b7/6d/3fe0c98888b6b7e0d60302a596890d5f6cc24a0171ec8336f422f8c081ba/django_view_hierarchy-0.1.5.tar.gz" } ] }