Merged Inlines
Merged Inlines is a Django App that allows you to merge multiple inline models into a single form. This is particularly useful if you need to mix the orderings of multiple authors together, so your inlines in the Admin panel can look like:
inline for Poem 1
inline for Poem 2
inline for Book 1
inline for Poem 3
inline for Book 2
Instead of:
inline for Poem 1
inline for Poem 2
inline for Poem 3
inline for Book 1
inline for Book 2
Installation
Install using pip:
pip install django-merged-inlines
Quick start
Add “merged_inlines” to your INSTALLED_APPS setting:
INSTALLED_APPS = (
....
'merged_inlines'
)
In the admin.py file for the app you’re adding merged inlines to, add:
from merged_inlines.admin import MergedInlineAdmin
Instead of admin.ModelAdmin, make your Admin class a child of MergedInlineAdmin, and add your inline classes as you normally would:
class MyFirstInline(admin.TabularInline):
pass
class MySecondInline(admin.TabularInline):
pass
class MyModelAdmin(MergedInlineAdmin):
inlines = [MyFirstInline,MySecondInline]
admin.site.register(MyModel,MyModelAdmin)
Note that regardless of the Inline class used (TabularInline or StackedInline), Merged Inlines currently only renders as a tabular inline.
Options
merged_field_order
You can use merged_field_order in your MergedInlineAdmin class to set the order of the fields. The list/type must contain all of fields that will be editable in the admin: to exclude fields from the formset, use the builtin ModelAdmin exclude function.
class MyInline(admin.TabularInline):
exclude = ('my_unwanted_field')
class MyModelAdmin(MergedInlineAdmin):
inlines = [MyInline]
merged_field_order = ('put_this_field_first','followed_by_this_field','and_then_this_one')
merged_inline_order
This option determines what field will be used to sort your merged inline models. The shared models must both have the shared field, otherwise an Exception will be raised. If no field is specified, id will be used.
class BookInline(admin.TabularInline):
model = Book
class PoemInline(admin.TabularInline):
model = Poem
class AuthorAdmin(MergedInlineAdmin):
merged_inline_order = 'year'
Version History
1.0 - Added full test coverage. Moved to Django 1.7+ compatibility, dropped compatibility with Django <1.7.
0.2 - Fixed ID ordering and js issues, thanks to @kotyy
0.1 - Initial release
Metadata
Release files for django-merged-inlines 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-merged-inlines-1.0.3.tar.gz | 11.1 kB | Without provenance | Details for django-merged-inlines-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_merged_inlines-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for django_merged_inlines-1.0.3-py3-none-any.whl |
Total release size: 24.5 kB
Release files / django-merged-inlines-1.0.3.tar.gz
| Download URL | django-merged-inlines-1.0.3.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d7fff5d8c542e09fe893cadff12e74cf155c1841fe68ba860d491d06b036939
|
|
BLAKE2b-256 checksum How to use checksums |
a2965627ae6712108771f5f14efc08aae7c308b349c7a276b7b7043260fd6d66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4
|
Release files / django_merged_inlines-1.0.3-py3-none-any.whl
| Download URL | django_merged_inlines-1.0.3-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fb349d826d6776f830dc6704e2f6b3e9c0d17f1bd436623131c543011202948
|
|
BLAKE2b-256 checksum How to use checksums |
1d022f023ddc39906e59e83decc60a2de1d628ca66693bb27807ceb6ceec7c19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4
|
Security for django-merged-inlines 1.0.3
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.