Skip to main content

Django Simulated Inlines

Built with Spacemacs

Description

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.

Features

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

Installation

  1. Install: pip install django_simulated_inlines
  2. add to INSTALLED_APPS:
    INSTALLED_APPS = [
        ...
        'django_simulated_inlines',
    ]

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 = (
        "id"
        ("custom_link", "/admin/custom/link/%s/"),
        "custom_field",
    )

    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"""
        execute_code()
    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]

Requirements

Metadata

Release files for django-simulated-inlines 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-simulated-inlines 0.1
File Size Uploaded Provenance Actions
django_simulated_inlines-0.1.tar.gz 8.8 kB Without provenance Details for django_simulated_inlines-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-simulated-inlines 0.1
File Interpreter ABI Platform Actions
django_simulated_inlines-0.1-py3-none-any.whl Python 3 none any Details for django_simulated_inlines-0.1-py3-none-any.whl

Total release size: 17.5 kB

Release files / django_simulated_inlines-0.1.tar.gz

Download URL django_simulated_inlines-0.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80f28f624d1abfc4463286ea0410905b6fa70ed546c7ce8c9d66dd21f3ab61ce
BLAKE2b-256 checksum
How to use checksums
58d197d767724d0680a5e3551038e034000d568c1109d4dfcd6c7af2bd8c94ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / django_simulated_inlines-0.1-py3-none-any.whl

Download URL django_simulated_inlines-0.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66d698867a3474f0229460a7137f54313d0382f49dd3063d424f0230328c74b0
BLAKE2b-256 checksum
How to use checksums
b62583298bd015c59bb85e35cd8a2de31f2473c43e7b72c5798897e425b81429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Security for django-simulated-inlines 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page