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 class FooAdmin(RelatedFieldAdmin): # these fields will work automatically: list_display = ('address__phone','address__country__country_code','address__foo') # ... but you can also define them manually if you need to override short_description: address__foo = getter_for_related_field('address__foo', short_description='Custom Name')
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.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c49c929a54ffe775d6f83e081ba6a4369b80725e1ee38dae3248d5d69eb714c9 |
|
MD5 | c8b77454fe912bee62d7de2ea1728de0 |
|
BLAKE2b-256 | f6a806e26e491d72e9392b7a4ef13931ba2056d082b7dbac8f3abbc6570e5bcc |