BertrandBordage / django-super-inlines

Adds useful features to inlines, such as the ability to nest them.
BSD 3-Clause "New" or "Revised" License
75 stars 8 forks source link

Django 2.0 support #22

Open Vadim-Karpenko opened 6 years ago

Vadim-Karpenko commented 6 years ago

Here is my solution how to make this project support Django 2.0 and newer. Go to the super_inlines\templatetags\super_inlines.py and replace all from this file by this code:



from __future__ import unicode_literals
from django.template import Library

from ..admin import SuperInlineModelAdmin

register = Library()
register_tag = register.simple_tag

@register_tag(takes_context=True)
def get_sub_inline_formsets(context, inline, original, index, is_template):
    if not isinstance(inline, SuperInlineModelAdmin):
        return ()
    request = context['request']
    formsets, inline_instances = inline._create_formsets(
        request, obj=original, change=original is not None, index=index,
        is_template=is_template)
    return inline.get_inline_formsets(request, formsets, inline_instances,
                                      obj=original)
WhyNotHugo commented 6 years ago

I've migrated over to django-nested-admin.

It seems to be actively maintained, and supports Django 2.0 just fine. Maybe it's time we gradually move over; there's little need to keep two different apps that do something this simply anyway.