# Path: feincms/extensions/base.py
# class ExtensionModelAdmin(admin.ModelAdmin):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self.initialize_extensions()
# 
#     def initialize_extensions(self):
#         if not hasattr(self, "_extensions_initialized"):
#             self._extensions_initialized = True
#             for extension in getattr(self.model, "_extensions", []):
#                 extension.handle_modeladmin(self)
# 
#     def add_extension_options(self, *f):
#         if self.fieldsets is None:
#             return
# 
#         if isinstance(f[-1], dict):  # called with a fieldset
#             self.fieldsets.insert(self.fieldset_insertion_index, f)
#             f[1]["classes"] = list(f[1].get("classes", []))
#             f[1]["classes"].append("collapse")
#         elif f:  # assume called with "other" fields
#             try:
#                 self.fieldsets[1][1]["fields"].extend(f)
#             except IndexError:
#                 # Fall back to first fieldset if second does not exist
#                 # XXX This is really messy.
#                 self.fieldsets[0][1]["fields"].extend(f)
# 
#     def extend_list(self, attribute, iterable):
#         extended = list(getattr(self, attribute, ()))
#         extended.extend(iterable)
#         setattr(self, attribute, extended)
# 
# Path: feincms/signals.py



import copy
import logging
import warnings
from django import forms
from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.utils import unquote
from django.contrib.auth import get_permission_codename
from django.http import Http404
from feincms.extensions import ExtensionModelAdmin
from feincms.signals import itemeditor_post_save_related
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------






# ------------------------------------------------------------------------
FEINCMS_CONTENT_FIELDSET_NAME = "FEINCMS_CONTENT"
FEINCMS_CONTENT_FIELDSET = (FEINCMS_CONTENT_FIELDSET_NAME, {"fields": ()})

logger = logging.getLogger(__name__)


# ------------------------------------------------------------------------

# Path: feincms/extensions/base.py
# class ExtensionModelAdmin(admin.ModelAdmin):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self.initialize_extensions()
# 
#     def initialize_extensions(self):
#         if not hasattr(self, "_extensions_initialized"):
#             self._extensions_initialized = True
#             for extension in getattr(self.model, "_extensions", []):
#                 extension.handle_modeladmin(self)
# 
#     def add_extension_options(self, *f):
#         if self.fieldsets is None:
#             return
# 
#         if isinstance(f[-1], dict):  # called with a fieldset
#             self.fieldsets.insert(self.fieldset_insertion_index, f)
#             f[1]["classes"] = list(f[1].get("classes", []))
#             f[1]["classes"].append("collapse")
#         elif f:  # assume called with "other" fields
#             try:
#                 self.fieldsets[1][1]["fields"].extend(f)
#             except IndexError:
#                 # Fall back to first fieldset if second does not exist
#                 # XXX This is really messy.
#                 self.fieldsets[0][1]["fields"].extend(f)
# 
#     def extend_list(self, attribute, iterable):
#         extended = list(getattr(self, attribute, ()))
#         extended.extend(iterable)
#         setattr(self, attribute, extended)
# 
# Path: feincms/signals.py



# Path: feincms/admin/item_editor.py
import copy
import logging
import warnings
from django import forms
from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.utils import unquote
from django.contrib.auth import get_permission_codename
from django.http import Http404
from feincms.extensions import ExtensionModelAdmin
from feincms.signals import itemeditor_post_save_related

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------






# ------------------------------------------------------------------------
FEINCMS_CONTENT_FIELDSET_NAME = "FEINCMS_CONTENT"
FEINCMS_CONTENT_FIELDSET = (FEINCMS_CONTENT_FIELDSET_NAME, {"fields": ()})

logger = logging.getLogger(__name__)


# ------------------------------------------------------------------------

class ItemEditorForm(forms.ModelForm):