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

Development Installation

If you're installing from source for development:

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

No additional configuration needed! The package works out of the box.

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.2.tar.gz (5.9 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.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_admin_recent_inlines-0.1.2.tar.gz
  • Upload date:
  • Size: 5.9 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.2.tar.gz
Algorithm Hash digest
SHA256 6262080ee7cba8183d3f0444303485c6a3858cf399041ee10587fca641ccb7a9
MD5 d84e6e642e0af5f04478d0c0f47d0314
BLAKE2b-256 cd0a1273c3fd146ecdeecec688018238ff5332cb57ad68c3a5b3586c723df86c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_admin_recent_inlines-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98eae19ccd3c57b38e8a3ce93199b4a48c60e82d4dcc1e060319592950ff5840
MD5 eae75fcf12395f7dd594023dce5b1a2c
BLAKE2b-256 24a5a89b2a1b30ce24317032090c7ca189518e6a32dc5674fe0783dce643b493

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