Skip to main content

Recent inlines with view-all functionality

Project description

Django Admin Recent Inlines

A Django package that provides a RecentTabularInline class for displaying recent related objects in Django admin with a "View All" link.

Features

  • Recent Inlines: Display only the most recent related objects in Django admin
  • View All Link: Automatically adds a "View All" link when there are more objects than the display limit
  • Configurable Limit: Set the maximum number of related objects to display
  • Django Admin Integration: Seamlessly integrates with Django's admin interface

Installation

pip install django-admin-recent-inlines

Usage

Basic Usage

from django.contrib import admin
from django_admin_recent_inlines.admin import RecentTabularInline
from .models import ParentModel, ChildModel

class ChildInline(RecentTabularInline):
    model = ChildModel
    maximum_number_of_related_rows_to_display = 5  # Show only 5 most recent

@admin.register(ParentModel)
class ParentAdmin(admin.ModelAdmin):
    inlines = [ChildInline]

Configuration Options

  • maximum_number_of_related_rows_to_display: Number of recent objects to display (default: 5)
  • template: Custom template for the inline (default: uses the provided template)
  • All standard TabularInline options are supported

How It Works

  1. The RecentTabularInline limits the queryset to show only the most recent related objects
  2. When there are more objects than the display limit, a "View All" link is automatically added
  3. The "View All" link takes you to the filtered changelist view showing all related objects
  4. The link includes the count of total related objects

Requirements

  • Python 3.11+
  • Django 4.0+

Development

Setup

git clone https://github.com/AugendLimited/django-admin-recent-inlines.git
cd django-admin-recent-inlines
poetry install

Running Tests

poetry run pytest

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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_admin_recent_inlines-0.1.1.tar.gz (5.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_admin_recent_inlines-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_recent_inlines-0.1.1.tar.gz.

File metadata

  • Download URL: django_admin_recent_inlines-0.1.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.10 Windows/11

File hashes

Hashes for django_admin_recent_inlines-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5f74d726511defdd3a7c98a64b77751e4ed7987ba0333fae0950d362e88ef8aa
MD5 4d817cb9da6d21cbabbd9423880d21c6
BLAKE2b-256 8dfda3f841af9b9399b6b146ef5a6f545a4a52e25f3da5258608a8c61ea51cc8

See more details on using hashes here.

File details

Details for the file django_admin_recent_inlines-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_recent_inlines-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a21945d5c045e14dfec998f8bac83ea41a9ea3d53788f0949d185d7ec24fd69
MD5 bcebc64e217be873b5a9db0e7636d9bd
BLAKE2b-256 2ff750604417609d2d2aa145fb0ed3d70c2c16757d88bf52e1b9b0defbdb0ab1

See more details on using hashes here.

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