Opened 9 years ago

Closed 9 years ago

#25106 closed Bug (invalid)

ManagementForm data is missing or has been tampered with "admin"

Reported by: Felipe Owned by: nobody
Component: contrib.admin Version: 1.8
Severity: Normal Keywords: admin, inlines, forms, formsets
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have note an incidence on the admin, That only happens when change the condition.

inlines = [ProductImageInline, AttributeInline]


def get_formsets_with_inlines(self, request, obj=None):
    """
    Yields formsets and the corresponding inlines.
    """
    for inline in self.get_inline_instances(request, obj):
        if obj is None and isinstance(inline, tuple(self.inlines)):
            continue
        # Here problem when already create obj, and try change parent return
        #: Exception Value: ['ManagementForm data is missing or has been tampered with']
        elif obj.is_parent and isinstance(inline, ProductImageInline):
            continue
        yield inline.get_formset(request, obj), inline

Depending on whether the object is parent or not, will decide if to show some Inline,

Change History (2)

comment:1 by Lagovas, 9 years ago

not enough information to determine the cause of your problem, because you are give an example to your classes without theirs code

comment:2 by Tim Graham, 9 years ago

Resolution: invalid
Status: newclosed

You may need to add some custom JavaScript to modify the management form to handle this case. I don't think Django can generically handle arbitrary get_formsets_with_inlines() methods like this one.

See TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top