Allow foreign key attributes in list_display with '__'
Project description
Allow foreign key attributes in list_display with ‘__’
This is based on DjangoSnippet 2996 which was made by Kpacn.
Installation
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
Add “related_admin” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'related_admin', )
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-related-admin-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41437bd6007bf81055fc5bab9ebfb34fccdb09218b568d967f91e789651a0e1f |
|
MD5 | a02a4939aa0eb94c33aed60dc5b1199f |
|
BLAKE2b-256 | 1b4121a877971cdc8d20d43c11db4595e99d6b1824d0196748e5c04b6b20a2d4 |