{ "info": { "author": "Marcus Whybrow", "author_email": "pypi@marcuswhybrow.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Distributed Computing" ], "description": "Django Lineage\r\n==============\r\n\r\nHandling which navigation element is active in a particular template can become\r\nannoying. Template blocks can be defined and later overriden to \"activate\" a\r\nclass on a particular navigational element, **but thats gets ugly!**\r\n\r\n**Lineage makes things neater** by defining your conditions centrally, and it\r\nlooks like this::\r\n\r\n {% load lineage %}\r\n \r\n \r\n\r\nWhen an ``ancestor`` tag is evaludated, it compares it's argument to the page URL.\r\nIf the argument string matches the start of the current pages URL, it outputs\r\n\"active\". **It's that simple!**\r\n\r\nRead on for accepted arguments:\r\n\r\nInstallation\r\n------------\r\n\r\nInstall using pip:\r\n\r\n pip install django-lineage\r\n\r\nAdd ``'lineage'`` to ``INSTALLED_APPS`` in ``settings.py``::\r\n\r\n INSTALLED_APPS = (\r\n 'lineage',\r\n )\r\n\r\nUsage\r\n-----\r\n\r\nThe ``ancestor`` tag needs to, of course, be loaded into your template:\r\n\r\n {% load lineage %}\r\n\r\nThe simplest way to use Lineage is the aformentioned ``ancestor`` tag. Again if\r\nthe argument matches the start of the page URL it outputs \"active\", this should\r\nhandle most use cases::\r\n\r\n {% ancestor '/arbitrary/path/' %}\r\n\r\nBut wait... ``ancestor`` can also handle variables, filters and all that stuff::\r\n\r\n {% ancestor some_variable|somefilter %}\r\n\r\nOr even full blown ``url`` tag type reverse resolution (Behind the scenes the\r\n``url`` tag derives our expected argument - a URL path string.)\r\n\r\n {% ancestor 'core:model_detail' model.pk %}\r\n\r\nActive?\r\n~~~~~~~\r\n\r\nBy default ``ancestor`` outputs \"active\" if it's argument matches the start of\r\nthe page URL. You can globally set the output of the ``ancestor`` tag by adding\r\n``LINEAGE_ANCESTOR_PHRASE = 'newphrase'`` to ``settings.py``\r\n\r\nAdvanced\r\n~~~~~~~~\r\n\r\nIf fine-grain control is what your after, you'll be looking for the\r\n``ifancestor/endifancestor`` combo::\r\n\r\n {% ifancestor 'pattern_name' %}\r\n This text here is only renderd if the\r\n URL argument is an ancestor.\r\n {% endifancestor %}\r\n\r\nIt accepts the same exact arguments as ``ancestor``, but allows you to define,\r\non a per definition basis, what the output will be.\r\n\r\n\r\nAssumptions\r\n-----------\r\n\r\nLineage depends on sensible URL hierarchies, because it compares paths using\r\nregex matching. The ``{% ifancestor '/base/' %}`` block will be true if the\r\ncurrent URL begins with that URL. For example ``/base/`` and ``/base/section/page/``\r\nreturn true, but ``/other/path/`` and ``/base`` (missing trailing slash) will not.\r\n\r\n``request`` must be present in the request context, since it's used to determine\r\nthe current URL. Django has `a context preprocessor`__ that can insert it for\r\nyou.\r\n\r\n.. _ContextProcessors: https://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request\r\n\r\n__ ContextProcessors_", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/marcuswhybrow/django-lineage/downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marcuswhybrow/django-lineage", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-lineage", "package_url": "https://pypi.org/project/django-lineage/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-lineage/", "project_urls": { "Download": "https://github.com/marcuswhybrow/django-lineage/downloads", "Homepage": "https://github.com/marcuswhybrow/django-lineage" }, "release_url": "https://pypi.org/project/django-lineage/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Lightweight template tags for neater hierarchical navigation", "version": "0.2.0" }, "last_serial": 789972, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "0feb10875c6252c29463a5d66c0c8f17", "sha256": "71b80bbbad785febe11eb317a060ef5ae89bdca81ff9e2896d7662a6823cbff1" }, "downloads": -1, "filename": "django-lineage-0.1.tar.gz", "has_sig": false, "md5_digest": "0feb10875c6252c29463a5d66c0c8f17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4139, "upload_time": "2013-04-11T13:27:22", "url": "https://files.pythonhosted.org/packages/5b/43/4707708b611cb8452ae1ef95f686fdc331bb48174d0520c963261bf21da4/django-lineage-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1773f31969ec90762522337a741ad3f5", "sha256": "41ecd5f0ed130d6aed6733f17f982f5bc16d52dc0000a46d49fc9fb2a97efa39" }, "downloads": -1, "filename": "django-lineage-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1773f31969ec90762522337a741ad3f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4136, "upload_time": "2013-04-11T14:38:12", "url": "https://files.pythonhosted.org/packages/dc/40/893e00cb0dc61795106a7808d62901250c378017e6490d8f87f109bf46db/django-lineage-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a92910bf0ea69427880769ab8f05b0cf", "sha256": "3b14a195b35a7a95ea027f79db714d2c8a8ec2f6f5d248c0024b3ad02d863d49" }, "downloads": -1, "filename": "django-lineage-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a92910bf0ea69427880769ab8f05b0cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4900, "upload_time": "2013-04-11T16:40:32", "url": "https://files.pythonhosted.org/packages/b3/f5/86f8ebe522c63118b6d43bae750f1fbea970eef16ec90cad6a5bafa88070/django-lineage-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a92910bf0ea69427880769ab8f05b0cf", "sha256": "3b14a195b35a7a95ea027f79db714d2c8a8ec2f6f5d248c0024b3ad02d863d49" }, "downloads": -1, "filename": "django-lineage-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a92910bf0ea69427880769ab8f05b0cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4900, "upload_time": "2013-04-11T16:40:32", "url": "https://files.pythonhosted.org/packages/b3/f5/86f8ebe522c63118b6d43bae750f1fbea970eef16ec90cad6a5bafa88070/django-lineage-0.2.0.tar.gz" } ] }