Skip to main content

A Django admin mixin for displaying related fields with clickable links.

Project description

django-related-field-display

A simple Django admin mixin to easily display and link related model fields using __ syntax.

This package allows you to use the double underscore (__) syntax in list_display and list_filter attributes of Django admin classes to display related model fields without needing to write custom methods or properties.

This project is inspired from django-admin-related package, but it is deprecated and not maintained anymore.

Installation

pip install django-related-field-display

Usage

from django.contrib import admin
from related_field_display.admin import RelatedFieldDisplayMixin
from .models import YourModel

@admin.register(YourModel)
class YourModelAdmin(RelatedFieldDisplayMixin, admin.ModelAdmin):
    list_display = ('id', 'related_field__name', 'another_field')
    list_filter = ('related_field__category',)
    ordering = ('-id',)

PyPI

PyPI version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_related_field_display-0.1.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_related_field_display-0.1.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page