{ "info": { "author": "Weston Nielson, Jan Schrewe, Arthur Hanson", "author_email": "wnielson@gmail.com, jschrewe@googlemail.com, worldnomad@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "django-genericadmin\n===================\n\nA simple django app to make the lookup of generic models easier.\n\nInstallation\n------------\n\nTo install add it to your ``INSTALLED_APPS`` setting. There is no need\nto run ``manage.py syncdb`` because *django-genericadmin* does not have\nany models.\n\n.. code:: python\n\n INSTALLED_APPS = (\n ...\n 'genericadmin',\n ...\n )\n\nIf you are using the staticfiles app, then run\n``manage.py collectstatic`` and you should be good to go.\n\nIf you don't know what I'm talking about or your django version < 1.3,\nthen you should link or copy ``genericadmin/media/js/`` to your asset\ndirectory and set ``GENERICADMIN_JS`` to a the relative destination of\nyour just copied files.\n\nUsage\n-----\n\nTo use *django-genericadmin* your model admin class must inherit from\n``GenericAdminModelAdmin``.\n\nSo a model admin like\n\n.. code:: python\n\n class NavBarEntryAdmin(admin.ModelAdmin):\n pass\n\n admin.site.register(NavBarEntry, NavBarEntryAdmin)\n\nbecomes\n\n.. code:: python\n\n from genericadmin.admin import GenericAdminModelAdmin\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n pass\n\n admin.site.register(NavBarEntry, NavBarEntryAdmin)\n\nThat's it.\n\nProvided admin classes\n----------------------\n\nA short overview of the admin classes and their uses provided by\n*django-genericadmin*.\n\n- **GenericAdminModelAdmin** \u2014 The admin for a standard Django model\n that has at least one generic foreign relation.\n\n- **TabularInlineWithGeneric** and **StackedInlineWithGeneric** \u2014\n Normal inline admins for models that have a generic relation and are\n edited inline.\n\n- **GenericTabularInline** and **GenericStackedInline** \u2014 Used to\n provide *True Polymorphic Relationships* (see below) and generic\n relations in the admin. Also see the Django docs\n `here `__.\n\nInline Usage\n------------\n\nTo use *django-genericadmin* with admin inlines, your models must\ninherit from ``GenericAdminModelAdmin`` as described above:\n\n.. code:: python\n\n from genericadmin.admin import GenericAdminModelAdmin\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n pass\n\n admin.site.register(NavBarEntry, NavBarEntryAdmin)\n\nAdditionally the inline classes must inherit from either\n``StackedInlineWithGeneric`` or ``TabularInlineWithGeneric``:\n\n.. code:: python\n\n from genericadmin.admin import GenericAdminModelAdmin, TabularInlineWithGeneric\n\n class PagesInline(TabularInlineWithGeneric):\n model = ...\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n inlines = [PagesInline, ]\n\n ...\n\nNote that you can't mix and match. If you're going to use a generic\ninline, the class using it must inherit from ``GenericAdminModelAdmin``.\n\nSpecifying which fields are handled\n-----------------------------------\n\nIn most cases *django-genericadmin* will correctly figure out which\nfields on your model are generic foreign keys and just do the right\nthing. If you want to specify the fields yourself (Control your own\ndestiny and all that) you can use the ``generic_fk_fields`` attribute on\nthe admin class. Note that you can specify the fields on each admin\nclass for inline admins. So, for the above mentioned inline admin, you\nwould do it like so:\n\n.. code:: python\n\n class PagesInline(TabularInlineWithGeneric):\n model = AReallyCoolPage\n generic_fk_fields = [{\n 'ct_field': ,\n 'fk_field': ,\n }]\n\nIf you want to use more then one field pair, you can just add more dicts\nto the list.\n\nIf you use the ``ct_field`` and ``ct_fk_field`` attributes\n*django-genericadmin* will always just ignore those fields and not even\ntry to use them.\n\nBlacklisting Content Types\n--------------------------\n\nSpecific content types can be removed from the content type select list.\nExample:\n\n.. code:: python\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n content_type_blacklist = ('auth/group', 'auth/user', )\n\nWhitelisting Content Types\n--------------------------\n\nSpecific content types that can be display from the content type select\nlist. Example:\n\n.. code:: python\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n content_type_whitelist = ('auth/message', )\n\nNote that this only happens on the client; there is no enforcement of\nthe blacklist at the model level.\n\nLookup parameters by Content Type\n---------------------------------\n\nSupply extra lookup parameters per content type similar to how\nlimit\\_choices\\_to works with raw id fields. Example:\n\n.. code:: python\n\n class NavBarEntryAdmin(GenericAdminModelAdmin):\n content_type_lookups = {'app.model': {'field': 'value'}\n\nTrue Polymorphic Relationships\n------------------------------\n\n``django-genericadmin`` also provides a UI to easily manage a\nparticularly useful model that, when used as an inline on another model,\nenables relations from any entry of any model to any other entry of any\nother model. And, because it has a generic relationship moving in both\ndirections, it means it can be attached as an inline *to any model*\nwithout having to create unique, individual foreign keys for each model\nyou want to use it on.\n\nHere's an example of a polymorphic model:\n\n.. code:: python\n\n from django.db import models\n from django.contrib.contenttypes.models import ContentType\n from django.contrib.contenttypes import generic\n\n class RelatedContent(models.Model):\n \"\"\"\n Relates any one entry to another entry irrespective of their individual models.\n \"\"\"\n content_type = models.ForeignKey(ContentType)\n object_id = models.PositiveIntegerField()\n content_object = generic.GenericForeignKey('content_type', 'object_id')\n\n parent_content_type = models.ForeignKey(ContentType, related_name=\"parent_test_link\")\n parent_object_id = models.PositiveIntegerField()\n parent_content_object = generic.GenericForeignKey('parent_content_type', 'parent_object_id')\n\n def __unicode__(self):\n return \"%s: %s\" % (self.content_type.name, self.content_object)\n\nAnd here's how you'd set up your admin.py:\n\n.. code:: python\n\n from whateverapp.models import RelatedContent\n from genericadmin.admin import GenericAdminModelAdmin, GenericTabularInline\n\n class RelatedContentInline(GenericTabularInline):\n model = RelatedContent\n ct_field = 'parent_content_type' # See below (1).\n ct_fk_field = 'parent_object_id' # See below (1).\n\n class WhateverModelAdmin(GenericAdminModelAdmin): # Super important! See below (2).\n content_type_whitelist = ('app/model', 'app2/model2' ) # Add white/black lists on this class\n inlines = [RelatedContentInline,]\n\n(1) By default ``ct_field`` and ``ct_fk_field`` will default to\n``content_type`` and ``object_id`` respectively. ``ct_field`` and\n``ct_fk_field`` are used to create the parent link from the inline to\nthe model you are attaching it to (similar to how Django does this\nattachment using foreign keys with more conventional inlines). You could\nalso leave this configuration out of your inline classes but, if you do\nthat, I encourage you to change the model attributes from\n``parent_content_type`` & ``parent_object_id`` to ``child_content_type``\n& ``child_object_id``. I say this because, when it comes time to make\nqueries, you'll want to know which direction you're 'traversing' in.\n\n(2) Make sure that whatever the admin classes are utilizing these\ninlines are subclasses of ``GenericAdminModelAdmin`` from\n``django-genericadmin`` or else the handy-dandy javascript-utilizing\ninterface won't work as intended.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/arthanson/django-genericadmin", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-genericadmin", "package_url": "https://pypi.org/project/django-genericadmin/", "platform": "", "project_url": "https://pypi.org/project/django-genericadmin/", "project_urls": { "Homepage": "https://github.com/arthanson/django-genericadmin" }, "release_url": "https://pypi.org/project/django-genericadmin/0.7.0/", "requires_dist": null, "requires_python": "", "summary": "Adds support for generic relations within Django's admin interface.", "version": "0.7.0" }, "last_serial": 3805452, "releases": { "0.4": [ { "comment_text": "", "digests": { "md5": "51d4841e41d8dfdb8d686c53ec044996", "sha256": "eb9db5b48371b5dc1150ffae7f2db3a93ed16e5ecf335fb28662a208e8d632a8" }, "downloads": -1, "filename": "django-genericadmin-0.4.tar.gz", "has_sig": false, "md5_digest": "51d4841e41d8dfdb8d686c53ec044996", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5226, "upload_time": "2013-06-24T14:38:09", "url": "https://files.pythonhosted.org/packages/0d/83/e6a20a736f0f8eeb38fc08b9384262b2fc4e3519996a9a3a7d60dfce12c6/django-genericadmin-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "706d2e2192c915c96d90c8de4fe57cbb", "sha256": "f37570be8dca4ff5280acb0d8e203e8d2fa8e649524ae9b45ff9df7c9efb366e" }, "downloads": -1, "filename": "django-genericadmin-0.5.tar.gz", "has_sig": false, "md5_digest": "706d2e2192c915c96d90c8de4fe57cbb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5934, "upload_time": "2013-10-23T13:46:12", "url": "https://files.pythonhosted.org/packages/f7/76/19d83799c1bb2c01d0de3fe375afe37321101046ef8f9d5321c7936fb7e0/django-genericadmin-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "f2c54d000b8849c82c1e5668b3314ad9", "sha256": "f8d74789929d66859e90dcbe391987ddaf7981eac8f9240e30fac189f972362a" }, "downloads": -1, "filename": "django-genericadmin-0.5.1.tar.gz", "has_sig": false, "md5_digest": "f2c54d000b8849c82c1e5668b3314ad9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5856, "upload_time": "2013-10-24T14:22:13", "url": "https://files.pythonhosted.org/packages/aa/36/541a61441c9ba10da0aef8842eb0760506e906f54fa8ef309a48df42f8ca/django-genericadmin-0.5.1.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "5c690d943dba6c10373129548ee9c24d", "sha256": "b9115df094d844335fe07e8a836d069bf23ab6ff203c8983ad79dc319adb0d93" }, "downloads": -1, "filename": "django-genericadmin-0.6.tar.gz", "has_sig": false, "md5_digest": "5c690d943dba6c10373129548ee9c24d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6210, "upload_time": "2013-11-24T15:55:09", "url": "https://files.pythonhosted.org/packages/c5/c1/2074ca1fc9112577d1857213a44ffc88702eb484ea607f5763d3083b3d60/django-genericadmin-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "4fb8646891b6ade064ecb8f4a2231e8c", "sha256": "604f8c79373cc1345c97d6f84eb431be0596dfc00defbdcd05502d85e6a8fe5a" }, "downloads": -1, "filename": "django-genericadmin-0.6.1.tar.gz", "has_sig": false, "md5_digest": "4fb8646891b6ade064ecb8f4a2231e8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12035, "upload_time": "2013-12-01T21:44:19", "url": "https://files.pythonhosted.org/packages/30/c1/3c5c0cb6e936c0e8913cea50d9acee49cd838e1439eaa207bb16fff1dc24/django-genericadmin-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "989acf570a4a34b1e0d31dcdf3de8e75", "sha256": "3f19c3de4d289d22e502970be33a17764ceee3b314e8c67ec59ccdde6b9bc031" }, "downloads": -1, "filename": "django_genericadmin-0.7.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "989acf570a4a34b1e0d31dcdf3de8e75", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12998, "upload_time": "2018-04-25T03:58:32", "url": "https://files.pythonhosted.org/packages/27/3c/8464606e463bc7cd05e59e6965dd59be83fa48754a307af4cb2b49cfeaee/django_genericadmin-0.7.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "251683179d09b7c0a1644afca49dd23d", "sha256": "980ee224eeb5f3bc2e98692499a3381be043dc30aee7c981e85fd6ca2259d93e" }, "downloads": -1, "filename": "django-genericadmin-0.7.0.tar.gz", "has_sig": false, "md5_digest": "251683179d09b7c0a1644afca49dd23d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11349, "upload_time": "2018-04-25T03:58:33", "url": "https://files.pythonhosted.org/packages/cc/ba/ec493ef92b12ad638e373d615ae24c821be20521baa48ef0555aa25c82b3/django-genericadmin-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "989acf570a4a34b1e0d31dcdf3de8e75", "sha256": "3f19c3de4d289d22e502970be33a17764ceee3b314e8c67ec59ccdde6b9bc031" }, "downloads": -1, "filename": "django_genericadmin-0.7.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "989acf570a4a34b1e0d31dcdf3de8e75", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12998, "upload_time": "2018-04-25T03:58:32", "url": "https://files.pythonhosted.org/packages/27/3c/8464606e463bc7cd05e59e6965dd59be83fa48754a307af4cb2b49cfeaee/django_genericadmin-0.7.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "251683179d09b7c0a1644afca49dd23d", "sha256": "980ee224eeb5f3bc2e98692499a3381be043dc30aee7c981e85fd6ca2259d93e" }, "downloads": -1, "filename": "django-genericadmin-0.7.0.tar.gz", "has_sig": false, "md5_digest": "251683179d09b7c0a1644afca49dd23d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11349, "upload_time": "2018-04-25T03:58:33", "url": "https://files.pythonhosted.org/packages/cc/ba/ec493ef92b12ad638e373d615ae24c821be20521baa48ef0555aa25c82b3/django-genericadmin-0.7.0.tar.gz" } ] }