Skip to content

Instantly share code, notes, and snippets.

View timobure's full-sized avatar

timobure

View GitHub Profile
@timobure
timobure / admin.py
Created July 5, 2021 08:10 — forked from dokterbob/admin.py
InlineAdmin mixin limiting the selection of related items according to criteria which can depend on the current parent object being edited.
class LimitedAdminInlineMixin(object):
"""
InlineAdmin mixin limiting the selection of related items according to
criteria which can depend on the current parent object being edited.
A typical use case would be selecting a subset of related items from
other inlines, ie. images, to have some relation to other inlines.
Use as follows::