{ "info": { "author": "Cameron McNierney", "author_email": "cameron.mcnierney@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# Django Materialized Paths\n\nA simple and lightweight implementation of materialized path tree structures in Django. \n\n## Installation\n\nTo install, run:\n\n```\npip install django-materialized-paths\n```\n\n## Configuration\n\nAdd the following into the INSTALLED_APPS of your projects: \n\n```python\nINSTALLED_APPS = (\n ...\n 'django-materialized-paths',\n)\n```\n\n## Usage\n\nTo use, extend the `BaseNode` into your model:\n\n```python\nfrom django-materialized-paths import BaseNode\n\nclass FolderExample(BaseNode):\n \"\"\"My folder class\"\"\"\n name = models.CharField(max_length=48)\n```\n\nThe model overrides Django's `django.db.models.Model` save() method to automatically manage changes to inheritance: \n\n```python\nfrom .models import FolderExample # concrete class from above\n\nroot = FolderExample.objects.create(name=\"root\")\nchild = FolderExample.objects.create(name=\"child\", parent=root)\ngrandchild = FolderExample.objects.create(name=\"child\", parent=child)\n```\n\nFor example, to convert `grandchild` to a root:\n\n```python\ngrandchild.parent = None\ngrandchild.save()\n```\n\n### Usage - Properties and Inherited \n\n```python\nBaseNode.depth # Root is 0\nBaseNode.parent\nBaseNode.children # Only returns direct descendants\n\nBaseNode.save() # Set the parent field to automatically manage hierarchy\nBaseNode.delete() # NOTE: The BaseNode.parent field is set to cascade, so deleting a parent will delete all children \n```\n\n### Usage - Methods \n\nNote that these methods generally return querysets \n\n```python\n# Accessors\n\nBaseNode.get_root()\nBaseNode.get_ancestor(depth=int)\nBaseNode.get_ancestors() \nBaseNode.get_descendants() \nBaseNode.get_siblings() \n\n# Convenience\n\nBaseNode.has_children()\nBaseNode.is_child_of(parent_id=int)\n\n# ID-based accessors - computed directly from path without accessing db\n\nBaseNode.get_ancestors_ids()\nBaseNode.get_descendants_ids()\n```\n\n## Authors\n\n* **Cameron McNierney** - *Original author* - https://github.com/cmcnierney\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cmcnierney/django-materialized-paths", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-materialized-paths", "package_url": "https://pypi.org/project/django-materialized-paths/", "platform": "", "project_url": "https://pypi.org/project/django-materialized-paths/", "project_urls": { "Homepage": "https://github.com/cmcnierney/django-materialized-paths" }, "release_url": "https://pypi.org/project/django-materialized-paths/0.1/", "requires_dist": null, "requires_python": "", "summary": "A simple and lightweight implementation of materialized path tree structures in Django.", "version": "0.1" }, "last_serial": 5197233, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "d9d30fa3f87f7846e4445491e37c2fe9", "sha256": "4a152d35e8cc8c5fd7a337040d871d83c585ae41967b8ef368be6fcc0ed9bcc3" }, "downloads": -1, "filename": "django_materialized_paths-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d9d30fa3f87f7846e4445491e37c2fe9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5199, "upload_time": "2019-04-27T17:14:00", "url": "https://files.pythonhosted.org/packages/47/30/9dff2c890af3f9819387aafdb148a57c8a76a01a22a597cda1467ad695f6/django_materialized_paths-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c42af4ec7eca7ff7beea1300cb1117ee", "sha256": "97593081e6dbf410e6aa9c7548caa0d2919f721eeaf6ae6b37f65cf6602e144c" }, "downloads": -1, "filename": "django-materialized-paths-0.1.tar.gz", "has_sig": false, "md5_digest": "c42af4ec7eca7ff7beea1300cb1117ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4404, "upload_time": "2019-04-27T17:14:35", "url": "https://files.pythonhosted.org/packages/5d/58/d2b1a7f5d51dad9478fbe90e6d462b592c8efe14230fbba4aaea5c3850fd/django-materialized-paths-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9d30fa3f87f7846e4445491e37c2fe9", "sha256": "4a152d35e8cc8c5fd7a337040d871d83c585ae41967b8ef368be6fcc0ed9bcc3" }, "downloads": -1, "filename": "django_materialized_paths-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d9d30fa3f87f7846e4445491e37c2fe9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5199, "upload_time": "2019-04-27T17:14:00", "url": "https://files.pythonhosted.org/packages/47/30/9dff2c890af3f9819387aafdb148a57c8a76a01a22a597cda1467ad695f6/django_materialized_paths-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c42af4ec7eca7ff7beea1300cb1117ee", "sha256": "97593081e6dbf410e6aa9c7548caa0d2919f721eeaf6ae6b37f65cf6602e144c" }, "downloads": -1, "filename": "django-materialized-paths-0.1.tar.gz", "has_sig": false, "md5_digest": "c42af4ec7eca7ff7beea1300cb1117ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4404, "upload_time": "2019-04-27T17:14:35", "url": "https://files.pythonhosted.org/packages/5d/58/d2b1a7f5d51dad9478fbe90e6d462b592c8efe14230fbba4aaea5c3850fd/django-materialized-paths-0.1.tar.gz" } ] }