Registry / web-framework / django-nonrelated-inlines

django-nonrelated-inlines

JSON →
library0.2pypypiunverified

Django admin inlines for unrelated models – allows using inline formsets for models without a direct foreign key relationship. Version 0.2, released to PyPI in 2021 (last release). Requires Django >= 3.0 and Python >= 3.6. Currently in maintenance mode with no recent updates.

pip install django-nonrelated-inlines
INSTALL
IMPORT
SIG · DJANGO-NONRELATED-
D
django-nonrelated-inlines
web-frameworkpythonv0.2
Install
3.4s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NonRelatedTabularInline
from nonrelated_inlines.admin import NonRelatedTabularInline
from nonrelated_inlines.admin import NonRelatedTabularInline

Define a non-related inline by providing a custom get_queryset method that filters based on the parent object.

from django.contrib import admin from nonrelated_inlines.admin import NonRelatedTabularInline from .models import Author, Book class BookInline(NonRelatedTabularInline): model = Book fields = ['title', 'published_date'] # Define how the inline relates to the parent via a custom queryset def get_queryset(self, request, obj): if obj: return self.model.objects.filter(author=obj) return self.model.objects.none() @admin.register(Author) class AuthorAdmin(admin.ModelAdmin): inlines = [BookInline]
Debug
Known issues
gotchaYou must override `get_queryset` manually; the inline does not automatically filter based on any relationship. Omitting this will show all objects in the inline.
fix
Always provide a custom `get_queryset` method that filters by the parent instance.
affects: all
gotchaThe `fk_name` attribute is not used; it expects a foreign key but this library works with unrelated models. Setting `fk_name` will not work as expected.
fix
Do not set `fk_name` on the inline class. Use `get_queryset` for filtering.
affects: all
deprecatedThe library has not been updated since 2021 and may not be compatible with newer Django versions (4.x, 5.x). Some admin internals have changed.
fix
Test with your Django version; consider forking or using alternative approaches (e.g., custom admin views).
affects: 0.2
Upgrade
Version history
0.2latest on PyPI · released Jun 6, 2022
Audit
Dependencies
DjangorequiredRequired for admin integration
Agent activity
4 hits · last 30 days
node
4
Resources
django-nonrelated-inlines — pip install django-nonrelated-inlines · libregistry