Skip to content

Saving fail, ending with 'ManagementForm data is missing or has been tampered with' #189

Open
@jerom-dev

Description

@jerom-dev

Hello I'm struggling with this since some time now, i don't manage to save any nested inline :(
I have installed the django-nested-admin-3.3.2

I have three level inlines (but it failed also with only 2)

First save fail like if there is an error in the form, and it removes the third level of nested inline
If i try to save a second time from this altered form i get the error 'ManagementForm data is missing or has been tampered with'

I don't know what i'm doing wrong, or what i can do to debug this.

in my settings.py
INSTALLED_APPS = [ ... 'my app', 'nested_admin', 'django.contrib.admin', ]

In my admin.py i have

class StratOpenOrderInline(nested_admin.NestedTabularInline):
    model = StratOpenOrder

class StratMainOrderInline(nested_admin.NestedStackedInline):
    model = StratMainOrder
    inlines = [StratOpenOrderInline]

@admin.register(Strategy)
class StrategyAdmin(nested_admin.NestedModelAdmin):
    inlines = [StratMainOrderInline]

in StratMainOrder.py

class StratMainOrder(models.Model):
    id_strategy= models.ForeignKey(Strategy, on_delete=models.CASCADE)
...

in StratOpenOrder.py

class StratOpenOrder(models.Model):
    id_strat_main_order= models.ForeignKey(StratMainOrder, on_delete=models.CASCADE)
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions