{ "info": { "author": "gitaarik", "author_email": "gitaarik@posteo.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries" ], "description": "# Django Admin relation links\n\nAn easy way to add links to relations in the Django Admin site.\n\n\n### Preview\n\nImagine you have admin pages for 2 models: `Member` and `Group`. `Member` has a `ForeignKey` relation to `Group`.\n\n- When you look at a member, you want to easily navigate to its group.\n- When you look at a group, you want to easily navigate to a list of the members in that group.\n\nWith the help of this app you can easily create these links:\n\n#### Member list page:\n![Member list page](https://raw.githubusercontent.com/gitaarik/django-admin-relation-links/master/screenshots/member-list-page.png)\n---------------------------\n\n#### Member change page:\n![Member change page](https://raw.githubusercontent.com/gitaarik/django-admin-relation-links/master/screenshots/member-change-page.png)\n---------------------------\n\n#### Group list page:\n![Member list page](https://raw.githubusercontent.com/gitaarik/django-admin-relation-links/master/screenshots/group-list-page.png)\n---------------------------\n\n#### Group change page:\n![Member change page](https://raw.githubusercontent.com/gitaarik/django-admin-relation-links/master/screenshots/group-change-page.png)\n\n\n### Install\n\n pip install django-admin-relation-links\n\n\n### How to use\n\nThe links are placed on the *change page* of the model and go to the *change\nlist page* or the *change page* of the related model, depending on whether the\nrelated model has a `ForeignKey` to this model or this model has a `ForeignKey`\nto the related model, or if it's a `OneToOneField`.\n\nSo for example, if you have these models:\n\n\n```python\nfrom django.db import models\n\n\nclass Group(models.Model):\n name = models.CharField(max_length=200)\n\n\nclass Member(models.Model):\n name = models.CharField(max_length=200)\n group = models.ForeignKey(Group, related_name='members')\n```\n\n\nThen in the admin you can add links on the `Group` *change page* to the\n`Member` *change list page* (all the members of that group) and on the `Member`\n*change page* a link to the `Group` *change page* (the group of that member).\n\n```python\nfrom django.contrib import admin\nfrom django_admin_relation_links import AdminChangeLinksMixin\n\n\n@admin.register(Group)\nclass GroupAdmin(AdminChangeLinksMixin, admin.ModelAdmin):\n list_display = ['name']\n changelist_links = ['members'] # Use the `related_name` of the `Member.group` field\n\n\n@admin.register(Member)\nclass MemberAdmin(AdminChangeLinksMixin, admin.ModelAdmin):\n list_display = ['name']\n change_links = ['group'] # Just specify the name of the `ForeignKey` field\n```\n\n\n### List page links\n\nIt is possible to show links on admin *list page* as well, using the field `{field_name}_link`:\n\n```python\n@admin.register(Member)\nclass MemberAdmin(AdminChangeLinksMixin, admin.ModelAdmin):\n list_display = ['name', 'group_link'] # Show link to group *change page* on member *list page*\n change_links = ['group']\n```\n\n\n### Link label\n\nBy default, the label of the link is the string representation of the model\ninstance. You can change the label by creating a method named\n`{field_name}_link_label()` like this:\n\n```python\n def group_link_label(self, group):\n return '{} ({} members)'.format(\n group.name,\n group.members.count()\n )\n```\n\n\n### Extra options\n\nYou can also set extra options like `label`, `model` and `lookup_filter` like this:\n\n```python\n@admin.register(Group)\nclass GroupAdmin(AdminChangeLinksMixin, admin.ModelAdmin):\n list_display = ['name']\n changelist_links = [\n ('members', {\n 'label': 'All members', # Used as label for the link\n 'model': 'Member', # Specify a different model, you can also specify an app using `app.Member`\n 'lookup_filter': 'user_group' # Specify the GET parameter used for filtering the queryset\n })\n ]\n```\n\n\n### List page ordering\n\nWhen showing links on the list page, when you use that field for ordering, the\ndefault ordering field is the first field in the `ordering` option on the\n`Meta` class of the model of the related field. You can specify an alternative\nordering like this:\n\n```python\n@admin.register(Group)\nclass MemberAdmin(AdminChangeLinksMixin, admin.ModelAdmin):\n list_display = ['name', 'group_link']\n change_links = [\n ('group', {\n 'admin_order_field': 'group__name', # Allow to sort members by `group_link` column\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/gitaarik/django-admin-relation-links/", "keywords": "django admin relation foreignkey link", "license": "GNU Lesser General Public License v3 (LGPLv3)", "maintainer": "", "maintainer_email": "", "name": "django-admin-relation-links", "package_url": "https://pypi.org/project/django-admin-relation-links/", "platform": "", "project_url": "https://pypi.org/project/django-admin-relation-links/", "project_urls": { "Homepage": "https://github.com/gitaarik/django-admin-relation-links/" }, "release_url": "https://pypi.org/project/django-admin-relation-links/0.2.4/", "requires_dist": null, "requires_python": ">=3", "summary": "An easy way to add links to relations in the Django Admin site.", "version": "0.2.4" }, "last_serial": 5890196, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b965098200d57dacc798911348bd544f", "sha256": "bd0d84e565de05849ae91f4ed2ed265da99cf49dccc52b0e8e5fb4d8cfa9df40" }, "downloads": -1, "filename": "django_admin_relation_links-0.0.2-py2.7.egg", "has_sig": false, "md5_digest": "b965098200d57dacc798911348bd544f", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 5435, "upload_time": "2017-05-23T11:14:24", "url": "https://files.pythonhosted.org/packages/6a/23/26367a7888d2ee3f18884286e5ba9f4b214d8aae2f1c76eec48625f3d667/django_admin_relation_links-0.0.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "6557bcd6e22368980e3b70f56881c09b", "sha256": "b29c4319b9f9479cabf96c8f899aef918846cd89c5aef647a822b8b9df542367" }, "downloads": -1, "filename": "django-admin-relation-links-0.0.2.tar.gz", "has_sig": false, "md5_digest": "6557bcd6e22368980e3b70f56881c09b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2008, "upload_time": "2017-05-23T11:14:22", "url": "https://files.pythonhosted.org/packages/6a/6f/e2c3b76cece267b3ebc702ad342d2d25ebb9ae8534cf0fb7c2a55a7b07ce/django-admin-relation-links-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "2f46a152ce7b56e9bcedede0876e08af", "sha256": "7d93a66513ee8ef1338c13baec4672d44c44e9491736ab7d4356b8e0faaa491b" }, "downloads": -1, "filename": "django-admin-relation-links-0.0.3.tar.gz", "has_sig": false, "md5_digest": "2f46a152ce7b56e9bcedede0876e08af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1987, "upload_time": "2017-05-24T12:15:12", "url": "https://files.pythonhosted.org/packages/81/1d/6c5676433d1c25a29c852438c109cc567bc4868c3696060c1758a4906a90/django-admin-relation-links-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "4b3fdc82b2a4624165c0c5f5431f6ace", "sha256": "88a23a468b0c894571a9f532dfb379d1675acf0d658646a129e665aeff033ed9" }, "downloads": -1, "filename": "django-admin-relation-links-0.0.4.tar.gz", "has_sig": false, "md5_digest": "4b3fdc82b2a4624165c0c5f5431f6ace", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1999, "upload_time": "2017-07-28T12:32:35", "url": "https://files.pythonhosted.org/packages/c7/31/b77ce05871b41306dc234bc72d69c4863ade3eedcbd7bdea285110851f0d/django-admin-relation-links-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "9c89669c16962cf1ab5f6c85f04a66b8", "sha256": "0e02c11ae5958d015fa2541a4e70e25e31506d6bdeb5de8858391178c57f635c" }, "downloads": -1, "filename": "django-admin-relation-links-0.0.5.tar.gz", "has_sig": false, "md5_digest": "9c89669c16962cf1ab5f6c85f04a66b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1971, "upload_time": "2018-01-10T16:57:54", "url": "https://files.pythonhosted.org/packages/04/5c/a2bb54fa098f07e0bfdf2da370d3c728c9c3c686c41ea63612d90477a4e5/django-admin-relation-links-0.0.5.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "bfd945fa1691a8875767033aa1e3e973", "sha256": "abe2b277ea1c48af98cfa8767f405903ebddc58d23c9b69e369a8309736b50cf" }, "downloads": -1, "filename": "django-admin-relation-links-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bfd945fa1691a8875767033aa1e3e973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2863, "upload_time": "2019-03-18T13:32:53", "url": "https://files.pythonhosted.org/packages/d0/b5/432434af742855007217406c332ced25dbf0ccbf25133b4aacf78bf375b8/django-admin-relation-links-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "87eb64fd161aa506627130e8f52934c2", "sha256": "85d969995332ad4af8b944d85323b5086ab6a5f5f226f2307a48365e1db1f753" }, "downloads": -1, "filename": "django-admin-relation-links-0.1.1.tar.gz", "has_sig": false, "md5_digest": "87eb64fd161aa506627130e8f52934c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2867, "upload_time": "2019-03-18T15:03:19", "url": "https://files.pythonhosted.org/packages/6c/4c/8cbf770ba6fc0e4779ae8775a8790f21bfc2361829e1df7bb12f62b81b5d/django-admin-relation-links-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "37ea47ff1660227ed523f83873ec4346", "sha256": "194a46ef3d678fbfe05d656ee9dcb39d3c51c185240f29917f9108e0111aa70d" }, "downloads": -1, "filename": "django_admin_relation_links-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "37ea47ff1660227ed523f83873ec4346", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4137, "upload_time": "2019-04-16T13:05:34", "url": "https://files.pythonhosted.org/packages/43/aa/899cb5798dd5305feee9747b16e81560abb79878fa8512206de38c243e94/django_admin_relation_links-0.2.0-py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b4d2c3daacf704287b3e1e363789e092", "sha256": "7ddccce38db474d7f7aeb6ca4b000aac3c4dc4100f2895d2920c270a4a8d31a3" }, "downloads": -1, "filename": "django-admin-relation-links-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b4d2c3daacf704287b3e1e363789e092", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3463, "upload_time": "2019-08-03T09:39:49", "url": "https://files.pythonhosted.org/packages/45/f4/4d947f5abb186e1ea4f35acf9f192978476bd414f42823953f9d09d335b1/django-admin-relation-links-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "868131756275719485417bebe0fb567e", "sha256": "27095fbdbce9671477b55ed1bcb09f3207ffdca3b3ddaea52ead5e2065c50b9f" }, "downloads": -1, "filename": "django-admin-relation-links-0.2.2.tar.gz", "has_sig": false, "md5_digest": "868131756275719485417bebe0fb567e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3608, "upload_time": "2019-09-26T11:02:49", "url": "https://files.pythonhosted.org/packages/9f/38/d8ee96d6c678a88a4d4d1c149d5a09169341f9c891556869aa081e57a639/django-admin-relation-links-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "ffc34952ffb7c93f251746a0aa0c0609", "sha256": "6307f8c610618b2aa4557fa48b40dc97b7f47f9e7fe0272016323beafd481035" }, "downloads": -1, "filename": "django-admin-relation-links-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ffc34952ffb7c93f251746a0aa0c0609", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4318, "upload_time": "2019-09-26T11:33:18", "url": "https://files.pythonhosted.org/packages/aa/b0/50d54efb58316609cd5ad1e94e08d921121d82b83b98ba23d27c44b3e15a/django-admin-relation-links-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "be05feb37bc96d42b121f75eacb23cd2", "sha256": "e06c3b5ee43690aa6cbad6aca65d2a6f8d1367861abd4055fb8294a3990065a6" }, "downloads": -1, "filename": "django-admin-relation-links-0.2.4.tar.gz", "has_sig": false, "md5_digest": "be05feb37bc96d42b121f75eacb23cd2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4344, "upload_time": "2019-09-26T11:39:29", "url": "https://files.pythonhosted.org/packages/10/09/3c2581f49348b791b4d7b1591ecc599f088be6ff24f69c54ed45ebd896f9/django-admin-relation-links-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "be05feb37bc96d42b121f75eacb23cd2", "sha256": "e06c3b5ee43690aa6cbad6aca65d2a6f8d1367861abd4055fb8294a3990065a6" }, "downloads": -1, "filename": "django-admin-relation-links-0.2.4.tar.gz", "has_sig": false, "md5_digest": "be05feb37bc96d42b121f75eacb23cd2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4344, "upload_time": "2019-09-26T11:39:29", "url": "https://files.pythonhosted.org/packages/10/09/3c2581f49348b791b4d7b1591ecc599f088be6ff24f69c54ed45ebd896f9/django-admin-relation-links-0.2.4.tar.gz" } ] }