django-related-admin


Namedjango-related-admin JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/PetrDlouhy/django-related-admin
SummaryAllow foreign key attributes in list_display with '__'
upload_time2020-07-15 14:34:18
maintainer
docs_urlNone
authorkpacn
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            ====================
django-related-admin
====================
.. image:: https://travis-ci.org/PetrDlouhy/django-related-admin.svg?branch=master
    :target: https://travis-ci.org/PetrDlouhy/django-related-admin
.. image:: https://coveralls.io/repos/github/PetrDlouhy/django-related-admin/badge.svg?branch=master
	 :target: https://coveralls.io/github/PetrDlouhy/django-related-admin?branch=master
.. image:: https://badge.fury.io/py/django-related-admin.svg
    :target: https://badge.fury.io/py/django-related-admin

Allow foreign key attributes in Django admin change list ``list_display`` with '__'

This is based on `DjangoSnippet 2996 <https://djangosnippets.org/snippets/2996/>`_ which was made by Kpacn.

Installation
------------

1. This library is on PyPI so you can install it with::

    pip install django-related-admin

or from github::

    pip install git+https://github.com/PetrDlouhy/django-related-admin#egg=django-related-admin

2. Add "related_admin" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = (
        ...
        'related_admin',
        'django.contrib.admin',
    )

Note: Django-related-admin changes ``change_list.html`` template to disable ``white-space: nowrap;``
css class on admin headers to allow long (posibly related) header names to wrap.
If you want this behaviour, add the app before ``django.contrib.admin``, otherwise after.


Usage
-----

Just use it instead of model.Admin::

   from related_admin import RelatedFieldAdmin
   from related_admin import getter_for_related_field

   class FooAdmin(RelatedFieldAdmin):
       # these fields will work automatically (and boolean fields will display an icon):
       list_display = ('address__phone','address__country__country_code','address__foo')

       # ... but you can also define them manually if you need to override short_description or boolean parameter:
       address__foo = getter_for_related_field('address__foo', short_description='Custom Name', boolean=True)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PetrDlouhy/django-related-admin",
    "name": "django-related-admin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "kpacn",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/8d/bc/29491759f665f2e148816bab8518e37337f74cbaff7be6cc18dda2a2716f/django-related-admin-1.0.1.tar.gz",
    "platform": "",
    "description": "====================\ndjango-related-admin\n====================\n.. image:: https://travis-ci.org/PetrDlouhy/django-related-admin.svg?branch=master\n    :target: https://travis-ci.org/PetrDlouhy/django-related-admin\n.. image:: https://coveralls.io/repos/github/PetrDlouhy/django-related-admin/badge.svg?branch=master\n\t :target: https://coveralls.io/github/PetrDlouhy/django-related-admin?branch=master\n.. image:: https://badge.fury.io/py/django-related-admin.svg\n    :target: https://badge.fury.io/py/django-related-admin\n\nAllow foreign key attributes in Django admin change list ``list_display`` with '__'\n\nThis is based on `DjangoSnippet 2996 <https://djangosnippets.org/snippets/2996/>`_ which was made by Kpacn.\n\nInstallation\n------------\n\n1. This library is on PyPI so you can install it with::\n\n    pip install django-related-admin\n\nor from github::\n\n    pip install git+https://github.com/PetrDlouhy/django-related-admin#egg=django-related-admin\n\n2. Add \"related_admin\" to your INSTALLED_APPS setting like this::\n\n    INSTALLED_APPS = (\n        ...\n        'related_admin',\n        'django.contrib.admin',\n    )\n\nNote: Django-related-admin changes ``change_list.html`` template to disable ``white-space: nowrap;``\ncss class on admin headers to allow long (posibly related) header names to wrap.\nIf you want this behaviour, add the app before ``django.contrib.admin``, otherwise after.\n\n\nUsage\n-----\n\nJust use it instead of model.Admin::\n\n   from related_admin import RelatedFieldAdmin\n   from related_admin import getter_for_related_field\n\n   class FooAdmin(RelatedFieldAdmin):\n       # these fields will work automatically (and boolean fields will display an icon):\n       list_display = ('address__phone','address__country__country_code','address__foo')\n\n       # ... but you can also define them manually if you need to override short_description or boolean parameter:\n       address__foo = getter_for_related_field('address__foo', short_description='Custom Name', boolean=True)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Allow foreign key attributes in list_display with '__'",
    "version": "1.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "879ef646a615171ddbd61d4cf01a9afe",
                "sha256": "abfa8a3f2fdb8e00e71313aab83de9036be9c0517f297b0d8d414d81cffd1d8d"
            },
            "downloads": -1,
            "filename": "django-related-admin-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "879ef646a615171ddbd61d4cf01a9afe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11169,
            "upload_time": "2020-07-15T14:34:18",
            "upload_time_iso_8601": "2020-07-15T14:34:18.285117Z",
            "url": "https://files.pythonhosted.org/packages/8d/bc/29491759f665f2e148816bab8518e37337f74cbaff7be6cc18dda2a2716f/django-related-admin-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-07-15 14:34:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "PetrDlouhy",
    "github_project": "django-related-admin",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "django-related-admin"
}
        
Elapsed time: 0.01657s