{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License" ], "description": "# Django Reverse Admin\n\nModule that makes django admin handle OneToOneFields in a better way. A common use case for one-to-one relationships is to \"embed\" a model inside another one. For example, a Person may have multiple foreign keys pointing to an Address entity, one home address, one business address and so on. Django admin displays those relations using select boxes, letting the user choose which address entity to connect to a person. A more natural way to handle the relationship is using inlines. However, since the foreign key is placed on the owning entity, django admins standard inline classes can't be used. Which is why I created this module that implements \"reverse inlines\" for this use case.\n\nFix/extension of:\n* [adminreverse](https://github.com/rpkilby/django-reverse-admin)\n* [reverseadmin](http://djangosnippets.org/snippets/2032/)\n\n[![CircleCI](https://circleci.com/gh/daniyalzade/django_reverse_admin.svg?style=svg)](https://circleci.com/gh/daniyalzade/django_reverse_admin)\n\n# Requirements\n\n* **Python**: 3.4, 3.5, 3.6, 3.7\n* **Django**: 2.0\n\nFrom Version 2.0 Django Filter is Python 3 only. If you need to support Python 2.7 use the version 1.0 release.\n\n# Installation\n\nInstall using pip:\n\n```sh\npip install django_reverse_admin\n```\n\n# Testing\n\nUse `tox` for testing.\n\n```sh\ntox\n```\n\n## Testing Manually Using Django Admin\n\nRun the following commands to make sure that db.sqlite3 has all the data that you need\n\n```sh\ncd tests\npython manage.py makemigrations\npython manage.py makemigrations polls\npython manage.py migrate\npython manage.py loaddata fixtures/init_data.json\npython manage.py runserver\n```\n\nAdmin user username is `reverse` and password is `reverseadmin`\n\n# Usage\n\n`models.py` file\n\n```py\nfrom django.db import models\n\nclass Address(models.Model):\n street = models.CharField(max_length=255)\n zipcode = models.CharField(max_length=10)\n city = models.CharField(max_length=255)\n state = models.CharField(max_length=2)\n\nclass Person(models.Model):\n name = models.CharField(max_length=255)\n business_addr = models.ForeignKey(Address,\n related_name='business_addr')\n home_addr = models.OneToOneField(Address, related_name='home_addr')\n other_addr = models.OneToOneField(Address, related_name='other_addr')\n```\n\n`admin.py` file\n\n```py\nfrom django.contrib import admin\nfrom django.db import models\nfrom models import Person\nfrom django_reverse_admin import ReverseModelAdmin\n\nclass PersonAdmin(ReverseModelAdmin):\n inline_type = 'tabular'\n inline_reverse = ['business_addr',\n ('home_addr', {'fields': ['street', 'city', 'state', 'zipcode']}),\n ]\nadmin.site.register(Person, PersonAdmin)\n```\n\ninline_type can be either \"tabular\" or \"stacked\" for tabular and stacked inlines respectively.\n\nThe module is designed to work with Django 2+ Since it hooks into the internals of the admin package, it may not work with later Django versions.\n\n# Demo\n\nBelow is what an admin change_view with reverse inline looks like\n![reverse inline](/images/admin_with_reverse_inline.png)\n\nBelow is what the same change_view would look like WITHOUT reverse inline\n![no reverse inline](/images/admin_without_reverse_inline.png)\n\n# Contribtion\n\n* Make sure that the tests are passing before opening up the PR\n* Create a PR for feature enhancements\n* Once a PR is merged, update version with the following commands:\n\n```\nbumpversion patch\ngit push origin master --tags\n```\n\n# Packaging\n\n`tox` creates a package in `.tox/dist`. Use twine to upload it to pypi:\n\n```sh\ntwine upload .tox/dist/django_reverse_admin-*.zip\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-reverse-admin", "package_url": "https://pypi.org/project/django-reverse-admin/", "platform": "", "project_url": "https://pypi.org/project/django-reverse-admin/", "project_urls": null, "release_url": "https://pypi.org/project/django-reverse-admin/2.6.1/", "requires_dist": null, "requires_python": "", "summary": "", "version": "2.6.1" }, "last_serial": 5830158, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "3d5f305f77f3adcb8f48645b373ceae4", "sha256": "5983c17483fd05281c352a43bdac678475a7ac4bad7a1b4e7c63235f6dcf30ee" }, "downloads": -1, "filename": "django_reverse_admin-0.0.5.zip", "has_sig": false, "md5_digest": "3d5f305f77f3adcb8f48645b373ceae4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6948, "upload_time": "2018-07-30T13:23:15", "url": "https://files.pythonhosted.org/packages/b6/5d/8a3bed79ef9426879a96680e31a709c5d87d2814980c7c24dd3cd0d1cee0/django_reverse_admin-0.0.5.zip" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "8efeadfaa696bef02c29628e3af851b0", "sha256": "2f5133db01297b0ba33cb595cba0baea8408d343a8021639edd564d95a01658d" }, "downloads": -1, "filename": "django_reverse_admin-1.0.0.zip", "has_sig": false, "md5_digest": "8efeadfaa696bef02c29628e3af851b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6945, "upload_time": "2018-07-30T13:27:14", "url": "https://files.pythonhosted.org/packages/04/4e/fd0ca13ae9f9bff87302d0c1a1bcdbbf8660108795ee16d2e450343f60f2/django_reverse_admin-1.0.0.zip" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2593697c8465105df93ff93217a99417", "sha256": "bfc355733bdd4ab0355c68a92f5ae01b6c0da8550d081f82dbb59f2f19e775ad" }, "downloads": -1, "filename": "django_reverse_admin-1.1.0.zip", "has_sig": false, "md5_digest": "2593697c8465105df93ff93217a99417", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7136, "upload_time": "2018-09-08T17:45:43", "url": "https://files.pythonhosted.org/packages/ac/81/b48702afb04bb45cf9144b0090e5519c382601b6b14c8b915153e4575ec1/django_reverse_admin-1.1.0.zip" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "0ec6195eaa434cb0b5993d064523732c", "sha256": "23eed7eef2a38efe02ca4a3f0fe62a985a90f36f6f2c29f7a92ba96fc6086d8c" }, "downloads": -1, "filename": "django_reverse_admin-2.0.0.zip", "has_sig": false, "md5_digest": "0ec6195eaa434cb0b5993d064523732c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7177, "upload_time": "2018-07-30T14:07:12", "url": "https://files.pythonhosted.org/packages/a6/0e/896856dbc43d9409fb2c824c19351d7242d1b8500f5ea2f256c4237ed9f3/django_reverse_admin-2.0.0.zip" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "952de6c810ff1b1136f2f2689d7c8be9", "sha256": "c672fb1df9ede3ee09bea8af038826ea8f9e7cee83ce87931c778a8846be8bdf" }, "downloads": -1, "filename": "django_reverse_admin-2.1.0.zip", "has_sig": false, "md5_digest": "952de6c810ff1b1136f2f2689d7c8be9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7328, "upload_time": "2018-08-25T07:33:50", "url": "https://files.pythonhosted.org/packages/cb/67/7300cf045ca1688c7ad2fac8bdfc7732e6eb5410bdac7db19663670d0f04/django_reverse_admin-2.1.0.zip" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "a1e9331a0eef9d3125e6c49175f1e5d4", "sha256": "fc7f27c1105b671bd71db92cbf9a99e6b27d2bc6be97a02025e71978a2a30019" }, "downloads": -1, "filename": "django_reverse_admin-2.1.1.zip", "has_sig": false, "md5_digest": "a1e9331a0eef9d3125e6c49175f1e5d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7357, "upload_time": "2018-08-25T08:13:13", "url": "https://files.pythonhosted.org/packages/4b/d4/506ade402ec6667562f53a64568cab6ecb5d63c2b86e10d099c62d7eac1c/django_reverse_admin-2.1.1.zip" } ], "2.3.0": [ { "comment_text": "", "digests": { "md5": "fc46c0d3589f98a77aeede69137ea7c3", "sha256": "05f291489f1ba150d9ce8115d3a9df1e97b00d635705972e29efb7a52bb65359" }, "downloads": -1, "filename": "django_reverse_admin-2.3.0.zip", "has_sig": false, "md5_digest": "fc46c0d3589f98a77aeede69137ea7c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7362, "upload_time": "2018-11-17T23:32:13", "url": "https://files.pythonhosted.org/packages/2b/a0/934720f12b0f635ec40321cca5940dca464999c921a32cdfa85033ec78f0/django_reverse_admin-2.3.0.zip" } ], "2.4.0": [ { "comment_text": "", "digests": { "md5": "4916872681c21e08f6e0d3e768e3eb9e", "sha256": "8de28e5b46c555658187f7cd231b018a87398220dfefb1c9b5bb7ce68ce1daa8" }, "downloads": -1, "filename": "django_reverse_admin-2.4.0.zip", "has_sig": false, "md5_digest": "4916872681c21e08f6e0d3e768e3eb9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10947, "upload_time": "2019-09-14T19:07:37", "url": "https://files.pythonhosted.org/packages/c6/56/2ff8a3e2e6012b57acf7c9482a9131688bb21f0d9b2330d771e837a6e671/django_reverse_admin-2.4.0.zip" } ], "2.6.0": [ { "comment_text": "", "digests": { "md5": "fda1717fa7a0574ecf3ca572ec7bf2c6", "sha256": "649f268780db3cb419d3009f11a12c1f5334f91b6e2b540f789165dd71deef2b" }, "downloads": -1, "filename": "django_reverse_admin-2.6.0.zip", "has_sig": false, "md5_digest": "fda1717fa7a0574ecf3ca572ec7bf2c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11670, "upload_time": "2019-09-14T20:27:33", "url": "https://files.pythonhosted.org/packages/66/17/f56b465d6a99afc0b8ed06ec00ea5d3d4001d21a92b254a27db6393aeb12/django_reverse_admin-2.6.0.zip" } ], "2.6.1": [ { "comment_text": "", "digests": { "md5": "678aa327f6d5bb288e47345c027bc331", "sha256": "6dfaf01022e90569550db2748c0ba36f8c7e9aab292ff782e5035da95b376df1" }, "downloads": -1, "filename": "django_reverse_admin-2.6.1.zip", "has_sig": false, "md5_digest": "678aa327f6d5bb288e47345c027bc331", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 162639, "upload_time": "2019-09-14T20:42:13", "url": "https://files.pythonhosted.org/packages/5f/92/68c28ce939630c621d62c713e57a6050d76053440f9ae3e36b28a5b89427/django_reverse_admin-2.6.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "678aa327f6d5bb288e47345c027bc331", "sha256": "6dfaf01022e90569550db2748c0ba36f8c7e9aab292ff782e5035da95b376df1" }, "downloads": -1, "filename": "django_reverse_admin-2.6.1.zip", "has_sig": false, "md5_digest": "678aa327f6d5bb288e47345c027bc331", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 162639, "upload_time": "2019-09-14T20:42:13", "url": "https://files.pythonhosted.org/packages/5f/92/68c28ce939630c621d62c713e57a6050d76053440f9ae3e36b28a5b89427/django_reverse_admin-2.6.1.zip" } ] }