Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jerom-dev opened this issue Oct 4, 2020 · 2 comments

Comments

@jerom-dev
Copy link

jerom-dev commented Oct 4, 2020

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)
...
@jerom-dev
Copy link
Author

Now i manage to avoid the error 'ManagementForm data is missing or has been tampered with' playing with the import orders
but the form is still not saving any data :(

@jacobjove
Copy link

jacobjove commented Jun 3, 2021

I also see this error often. It seems to happen when a form is left open for too long (overnight, for example) and then submitted.

Screen Shot 2021-06-03 at 12 16 12

The error only happens with admin forms that use nested_admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants