Skip to main content

A Django app to allow for readonly admin inlines without relationship to the base model

Project description

Django Simulated Inlines

Built with Spacemacs


This package extends the ModelAdmin interface with the possibility to create custom inlines that can contain a list of any Model instances, the relationship with the base change_form is not needed.


  • inlines can be collapsed
  • supports inline subtitles
  • pagination
  • custom links for any inline cell
  • dynamic fields
  • action buttons


  1. Install: pip install django_simulated_inlines
  2. add to INSTALLED_APPS:

How to Use

  • Import the ModelAdmin and Inline classes

from django_simulated_inlines.admin import SimulatedInline, SimulatedInlinesModelAdmin

  • Declarating inlines:
class ExampleInline(SimulatedInline):
    model = ExampleModel
    verbose_name = _("example")
    verbose_name_plural = _("examples")
    per_page = 20
    buttons = ("example_button", )
    collapse = True
    fields = (
        ("custom_link", "/admin/custom/link/%s/"),

    def custom_field(self, obj):
        """The return of this function is the value on the field cell"""
        return f"Custom field for {self.field}"
    custom_field.short_description = _("custom field")

    def example_button(self, request, object_id):
        """This function is called when the button is pressed"""
    example_button.short_description = _("Execute example button")

    def get_subtitle(self, request, object_id):
        """Override this to define a subtitle for the inline"""
        return "this is a subtitle"

    def get_queryset(self, request, object_id, parent_queryset):
       """Override this to filter or customize de queryset"""
       return self.model.objects.filter(x=object_id).all()
  • Add the inlines to the SimulatedInlinesModelAdmin.simulated_inlines.
class ExampleModelAdmin(SimulatedInlinesModelAdmin):
    simulated_inlines = [ExampleSimulatedInline]


Project details

Download files

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

Files for django-simulated-inlines, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_simulated_inlines-0.1-py3-none-any.whl (8.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django_simulated_inlines-0.1.tar.gz (8.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page