Skip to content

Instantly share code, notes, and snippets.

View stefanitsky's full-sized avatar
🏄‍♂️

Alexandr Stefanitsky-Mozdor stefanitsky

🏄‍♂️
View GitHub Profile
@stefanitsky
stefanitsky / admin.py
Created March 10, 2020 20:28 — 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::