This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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

  1. Add “merged_inlines” to your INSTALLED_APPS setting:
INSTALLED_APPS = (
    ....
    'merged_inlines'
)
  1. In the admin.py file for the app you’re adding merged inlines to, add:
from merged_inlines.admin import MergedInlineAdmin
  1. 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
Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-merged-inlines-1.0.1.tar.gz (9.1 kB) Copy SHA256 Checksum SHA256 Source Jun 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting