{ "info": { "author": "Texas Tribune & The Center for Investigative Reporting", "author_email": "dev@armstrongcms.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "armstrong.core.arm_layout\r\n=========================\r\n\r\n.. image:: https://travis-ci.org/armstrong/armstrong.core.arm_layout.svg?branch=master\r\n :target: https://travis-ci.org/armstrong/armstrong.core.arm_layout\r\n :alt: TravisCI status\r\n.. image:: https://coveralls.io/repos/armstrong/armstrong.core.arm_layout/badge.png\r\n :target: https://coveralls.io/r/armstrong/armstrong.core.arm_layout\r\n :alt: Coverage status\r\n.. image:: https://pypip.in/version/armstrong.core.arm_layout/badge.png\r\n :target: https://pypi.python.org/pypi/armstrong.core.arm_layout/\r\n :alt: PyPI Version\r\n.. image:: https://pypip.in/license/armstrong.core.arm_layout/badge.png\r\n :target: https://pypi.python.org/pypi/armstrong.core.arm_layout/\r\n :alt: License\r\n\r\nProvides layout and templating features for use in Armstrong and Django\r\nprojects. ``arm_layout`` provides tools to help streamline displaying content\r\nand excels at rendering standardized, model-specific templates that are easy\r\nto share or overwrite to be as general or specific as you need. Render your\r\nmodel objects wherever you need them in your templates without worrying about\r\nobject specifics or view logic.\r\n\r\n\r\nUsage\r\n-----\r\nCheat sheet\r\n\"\"\"\"\"\"\"\"\"\"\"\r\n::\r\n\r\n {% load layout_helpers %}\r\n\r\n {% render_model model_obj \"template_name\" %}\r\n\r\n \r\n {% render_model model_obj \"template_name\" with additional=\"data\" %}\r\n {% render_model model_obj \"template_name\" with isolated=\"context\" only %}\r\n\r\n \r\n {% render_list list_of_models \"template_name\" %}\r\n\r\n \r\n {% render_iter list_of_models %}\r\n {% render_next \"big\" %}\r\n {% render_next \"small\" %}\r\n {% render_next \"big\" %}\r\n {% render_remainder \"small\" %}\r\n {% endrender_iter %}\r\n\r\nIn depth\r\n\"\"\"\"\"\"\"\"\r\nTo load the template tags, add the following line (generally at the top of your\r\ntemplate)::\r\n\r\n {% load layout_helpers %}\r\n\r\nNow you can use the ``render_model`` template tag to display a given model\r\nlike this::\r\n\r\n {% render_model some_model \"full_page\" %}\r\n\r\n``some_model`` is a variable in your template that is a model instance and the\r\nstring ``\"full_page\"`` is the name of your \"layout\". ``render_model`` looks\r\nfor a template named ``layout///.html`` to determine\r\nwhat to use to display your model instance. Going one step further, it is smart\r\nenough to walk through the inheritance of the model to determine if there are\r\nany parent models that have the layout that can be used. For example, if\r\n``some_model`` was an instance of ``armstrong.apps.articles.models.Article``\r\nthat inherits from ``armstrong.apps.content.models.Content``, ``render_model``\r\nlooks for the following templates, in this order::\r\n\r\n [\"layout/articles/article/full_page.html\",\r\n \"layout/content/content/full_page.html\", ]\r\n\r\nYou have access to the entire template context inside the ``full_page.html``\r\ntemplate. You also have a new variable called ``object`` which represents the\r\nmodel instance that you provided to ``render_model``. That variable is only\r\navailable inside the layout template and temporarily overrides any other\r\ncontext variable called ``object``. Aside from the flexibility of looking up a\r\ntemplate based on model inheritance, this tag works just like `{% include %}`_.\r\nYou can add to the context using ``with extra=\"param\"`` or isolate the context\r\nusing ``only``. Once ``render_model`` is finished, it restores the original\r\ncontext.\r\n\r\n``layout_helpers`` provides two other helper methods for easily rendering\r\nmultiple models without having to manually loop through them. You can render\r\nan entire list of models using the same template::\r\n\r\n {% render_list list_of_models \"preview\" %}\r\n\r\nOr have finer control with a block tag that lets you step through each model\r\ninstance specifying the template each time and then rendering all the rest\r\nwith a common template::\r\n\r\n {% render_iter list_of_models %}\r\n {% render_next \"preview\" %}\r\n {% render_next \"preview\" %}\r\n {% render_next \"preview\" %}\r\n {% render_remainder \"headline\" %}\r\n {% endrender_iter %}\r\n\r\nOf course you could do the same thing another way::\r\n\r\n {% render_list list_of_models[:3] \"preview\" %}\r\n {% render_list list_of_models[3:] \"headline\" %}\r\n\r\nA limitation of these loop helpers is they cannot add or limit the context\r\nusing ``with`` or ``only`` as ``render_model`` can. You could however wrap\r\nthe tags in a ``{% with need=\"this\" and=\"that\" %} ... {% endwith %}`` block.\r\nSee the `with documentation`_.\r\n\r\n.. _{% include %}: https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#include\r\n.. _with documentation: https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#with\r\n\r\n\r\nInstallation & Configuration\r\n----------------------------\r\nSupports Django 1.3, 1.4, 1.5, 1.6, 1.7 on Python 2.6 and 2.7.\r\n\r\n#. ``pip install armstrong.core.arm_layout``\r\n\r\n#. Add ``armstrong.core.arm_layout`` to your ``INSTALLED_APPS``\r\n\r\n**Optional Setting:** (Used in ``settings.py`` and safe to omit)\r\n\r\n``ARMSTRONG_LAYOUT_BACKEND = \"armstrong.core.arm_layout.backends.BasicLayoutBackend\"``\r\n Backends specify how the template tags actually determine template paths.\r\n There are two options--``BasicLayoutBackend`` and\r\n ``ModelProvidedLayoutBackend``. Basic uses model inheritance as a directory\r\n structure. ModelProvided does the same, but optionally allows a model to\r\n determine its own template lookup. A few model mixins are provided for\r\n common scenarios. Feel free to write your own backend if you need other\r\n functionality.\r\n\r\n\r\nContributing\r\n------------\r\nDevelopment occurs on Github. Participation is welcome!\r\n\r\n* Found a bug? File it on `Github Issues`_. Include as much detail as you\r\n can and make sure to list the specific component since we use a centralized,\r\n project-wide issue tracker.\r\n* Testing? ``pip install tox`` and run ``tox``\r\n* Have code to submit? Fork the repo, consolidate your changes on a topic\r\n branch and create a `pull request`_. The `armstrong.dev`_ package provides\r\n tools for testing, coverage and South migration as well as making it very\r\n easy to run a full Django environment with this component's settings.\r\n* Questions, need help, discussion? Use our `Google Group`_ mailing list.\r\n\r\n.. _Github Issues: https://github.com/armstrong/armstrong/issues\r\n.. _pull request: http://help.github.com/pull-requests/\r\n.. _armstrong.dev: https://github.com/armstrong/armstrong.dev\r\n.. _Google Group: http://groups.google.com/group/armstrongcms\r\n\r\n\r\nState of Project\r\n----------------\r\n`Armstrong`_ is an open-source news platform that is freely available to any\r\norganization. It is the result of a collaboration between the `Texas Tribune`_\r\nand `The Center for Investigative Reporting`_ and a grant from the\r\n`John S. and James L. Knight Foundation`_. Armstrong is available as a\r\ncomplete bundle and as individual, stand-alone components.\r\n\r\n.. _Armstrong: http://www.armstrongcms.org/\r\n.. _Texas Tribune: http://www.texastribune.org/\r\n.. _The Center for Investigative Reporting: http://cironline.org/\r\n.. _John S. and James L. Knight Foundation: http://www.knightfoundation.org/\r\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/armstrong/armstrong.core.arm_layout/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "armstrong.core.arm_layout", "package_url": "https://pypi.org/project/armstrong.core.arm_layout/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/armstrong.core.arm_layout/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/armstrong/armstrong.core.arm_layout/" }, "release_url": "https://pypi.org/project/armstrong.core.arm_layout/1.4.0/", "requires_dist": null, "requires_python": null, "summary": "Layout code related to Armstrong", "version": "1.4.0" }, "last_serial": 1216646, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8c730bdc4a543ad8738f5b1c39a0b72a", "sha256": "382f9ec99dc6aeeb345696e8d57e9bf9508fbbd04e7cd079d03bdfd8ea538a96" }, "downloads": -1, "filename": "armstrong.core.arm_layout-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8c730bdc4a543ad8738f5b1c39a0b72a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6648, "upload_time": "2011-07-23T00:14:21", "url": "https://files.pythonhosted.org/packages/b1/8f/4b56e6cb97c8184df102cdfa69b4d1623ac23fb556e8f712abc6e21ec96b/armstrong.core.arm_layout-0.1.0.tar.gz" } ], "0.1.0.alpha.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ca740a443e9bc5f12e5a0da75b27088e", "sha256": "69023502182ff4d26b161d2a487ab08710fa16f8bd344645ab485c0e5a02461e" }, "downloads": -1, "filename": "armstrong.core.arm_layout-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ca740a443e9bc5f12e5a0da75b27088e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7828, "upload_time": "2011-08-22T21:40:05", "url": "https://files.pythonhosted.org/packages/70/96/74ac3ee7c37d56e434357720c33842041893ef59c860e738291eb593a007/armstrong.core.arm_layout-0.2.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "c15ed943dcd38db259dd72ab7dee9169", "sha256": "166305e4da05b7ecfcc0ba4356e284e74e21d210511220d2655bb8ccd26decc6" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c15ed943dcd38db259dd72ab7dee9169", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7823, "upload_time": "2011-10-01T00:43:09", "url": "https://files.pythonhosted.org/packages/50/a1/3f7706cff846b251c108d55f8bcd108b44a8f95791a71e79f7e2a17e9b31/armstrong.core.arm_layout-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "599cc5cd08c5631ed5d81c433f4da5a2", "sha256": "6dfbde3d91df1864caa0ebf93b512b5057de1103a97599d456ce1e6f6e33bd5b" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.1.0.tar.gz", "has_sig": false, "md5_digest": "599cc5cd08c5631ed5d81c433f4da5a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8018, "upload_time": "2012-03-21T19:11:37", "url": "https://files.pythonhosted.org/packages/dc/18/be887f6e36c1a7f6f5c640e61e808e88677176d7499e3fc0ee59b1dd1eef/armstrong.core.arm_layout-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "9a902aa921db81287053e82edd4b755a", "sha256": "05941d81643137ce031cc28527eea977ba9278819a23260dacf851050146bda6" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.1.1.tar.gz", "has_sig": false, "md5_digest": "9a902aa921db81287053e82edd4b755a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8133, "upload_time": "2012-03-29T22:48:16", "url": "https://files.pythonhosted.org/packages/73/94/739f190d4147daf44efa910b7bb649a6bfb1960d773d8bc6a90d59a3e2ae/armstrong.core.arm_layout-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "3a165ee009d152f0594b858cf9148ba7", "sha256": "93cdbc700721c08c961f40f483c25d5638b7780917feb36ece0e202dfc73f9b9" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.1.2.tar.gz", "has_sig": false, "md5_digest": "3a165ee009d152f0594b858cf9148ba7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8136, "upload_time": "2013-01-29T20:18:23", "url": "https://files.pythonhosted.org/packages/2b/60/18637896fcf63083576a69d26fbeb1d24dd21bfbd5304805bfec3107518e/armstrong.core.arm_layout-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "9e1eeeae8c7d14e2fa2433b465b34115", "sha256": "02d7ca4b7064cd4d1d1bf16a58fd6d232d16d44f5513c122d9b6255c665d3768" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.1.3.tar.gz", "has_sig": false, "md5_digest": "9e1eeeae8c7d14e2fa2433b465b34115", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8126, "upload_time": "2013-02-20T22:46:06", "url": "https://files.pythonhosted.org/packages/84/5c/bfbf054b1190b58a5f26d1dad5f4e9bba2a60c7457070adec217f5a8beec/armstrong.core.arm_layout-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "bfd614d3d3b4d9b87e105550e7814062", "sha256": "3836577aeaea4d88829e15590587f4563e4d9f722daa37c60fc8b7bc8964404a" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.1.4.tar.gz", "has_sig": false, "md5_digest": "bfd614d3d3b4d9b87e105550e7814062", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8131, "upload_time": "2013-02-20T22:53:05", "url": "https://files.pythonhosted.org/packages/da/4c/98f24a0f9c863a75cbbf7f0868e37e72018ec2e7c448b4a1af70b3bd27cd/armstrong.core.arm_layout-1.1.4.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "d0ee3430772fcb96d79a34889df3119e", "sha256": "1d76b63489b2205849f6fa653c7298fdcb81a181b32f940e7cc0c24ddcb9b400" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.2.0.tar.gz", "has_sig": false, "md5_digest": "d0ee3430772fcb96d79a34889df3119e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12295, "upload_time": "2013-10-04T00:36:05", "url": "https://files.pythonhosted.org/packages/1c/d8/3f05994835cefe9e4afc5c0c1f5671cc7fdeff0658796db801b5369963fe/armstrong.core.arm_layout-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "fe5f43b4edf82b37dcdc5d36ed918af0", "sha256": "920a35d4f36efb422eb71e6dae2451271e8496d3ffd77ece7dd409053f6366be" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.3.0.tar.gz", "has_sig": false, "md5_digest": "fe5f43b4edf82b37dcdc5d36ed918af0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13498, "upload_time": "2014-02-24T22:35:08", "url": "https://files.pythonhosted.org/packages/3c/d3/e8bb81069d3cc308e841ed49f4732b181bdda36af065bb7a531b4f0783eb/armstrong.core.arm_layout-1.3.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "b04f17915cfd69dc62455a1d7448d244", "sha256": "a6a46b996c0a2a123ac6bb5b86ff76b2fc7323635fe0b6f7f417ced630bfd1d8" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.4.0.tar.gz", "has_sig": false, "md5_digest": "b04f17915cfd69dc62455a1d7448d244", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12246, "upload_time": "2014-09-08T05:26:26", "url": "https://files.pythonhosted.org/packages/04/d9/da8d91a3b60e76754c65d3a833652d1340d4e6e994946f27588d5b7f95fc/armstrong.core.arm_layout-1.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b04f17915cfd69dc62455a1d7448d244", "sha256": "a6a46b996c0a2a123ac6bb5b86ff76b2fc7323635fe0b6f7f417ced630bfd1d8" }, "downloads": -1, "filename": "armstrong.core.arm_layout-1.4.0.tar.gz", "has_sig": false, "md5_digest": "b04f17915cfd69dc62455a1d7448d244", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12246, "upload_time": "2014-09-08T05:26:26", "url": "https://files.pythonhosted.org/packages/04/d9/da8d91a3b60e76754c65d3a833652d1340d4e6e994946f27588d5b7f95fc/armstrong.core.arm_layout-1.4.0.tar.gz" } ] }