Django admin error ValidationError: [u'ManagementForm data is missing or has been tampered with']

Dhanushka Amarakoon

Hi I am creating an model admin with dynamic inline's.

class InlineProfile(admin.TabularInline):
    model = Profile
#     max_num = 1

class InlineProfileOne(admin.TabularInline):
    model = TableOne
#     max_num = 1

class InlineProfileTwo(admin.TabularInline):
    model = TableTwo
#     max_num = 1

class UserDisplay(admin.ModelAdmin):
    inlines = [InlineProfile]

    def get_inline_instances(self, request, obj=None):
        up=UserProfile.objects.get(pk=obj.id)
        if (up.job_type.job_type==1):
            self.inlines.append(InlineProfileOne)
        elif (up.job_type.job_type==2):
            self.inlines.append(InlineProfileTwo)
        return obj and super(UserDisplay, self).get_inline_instances(request, obj) or []

#     def get_formsets(self, request, obj):
#         print obj
#         for inline in self.get_inline_instances(request, obj):
#             yield inline.get_formset(request, obj)

    list_display = [f.name for f in LCUser._meta.fields]
    field_set = list(list_display)
    field_set.remove('id')
    field_set.remove('api_key')
    field_set.remove('api_secret')

    readonly_fields=['last_login_ip','last_login_timestamp','created_at','updated_at']

    fieldsets = (
        (None, {
            'fields': field_set,

        }),
        ('Advanced options', {
            'classes': ('collapse',),
            'fields': ('api_key', 'api_secret'),
        }),
    )

    search_fields=list_display
    list_filter=['user_type','profile_complete']
    list_editable=list(list_display)
    list_editable.remove('id')
    list_editable.remove('updated_at')
    list_editable.remove('created_at')
    list_editable.remove('last_login_timestamp')
    list_editable.remove('last_login_ip')

    class Meta:
        model = LCUser

On display I somtimes see two inline rows instead of one and when I try to update it I get "ManagementForm data is missing or has been tampered with"

Dhanushka Amarakoon

Figured out what I was doing wrong. looks like I forgot to initialize the inlinse variable. So everytime I clicked on an object it added the same inline model again, which caused errors when I tried to save it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Django admin error ValidationError: [u'ManagementForm data is missing or has been tampered with']

From Dev

django ValidationError: u'ManagementForm data is missing or has been tampered with'

From Dev

ManagementForm data is missing or has been tampered with

From Dev

How to verify that a URL parameter has not been tampered with?

From Dev

ManagementForm Data is Missing When Using Formset Prefix

From Dev

SQL Server installation is either corrupt or has been tampered with error getting instance id from name

From Dev

Django Admin ValidationError on save with inlines

From Dev

SQL Server 2012: A way to see if the database has been tampered with?

From Dev

django_admin_log has not been created for me

From Dev

Resolving ValidationError: [u"'' value has an invalid date format. It must be in YYYY-MM-DD format."] in Django 1.9.2?

From Dev

Django DateTimeField ValidationError: value has an invalid format

From Dev

django - Missing fields in the admin

From Dev

django admin missing records

From Dev

Newrelic error in Django : Configuration has already been done

From Dev

The field was declared on serializer , but has not been included error in django rest

From Dev

New user signup causing error in admin view - ?missing data

From Dev

u' admin' is not a registered namespace in django

From Dev

Sending error response to socket after data has been writen

From Dev

The ConnectionString property has not been initialized Error during inserting data to Database

From Dev

What can cause a sporadic "-2147352567 The data has been changed" error?

From Dev

Error with reformatting the way data has been passed into a function

From Dev

Django raise Validationerror leads to Valuetype Error

From Dev

Rails admin "username has already been taken"

From Dev

How can I prove to an outside party that a data file hasn't been tampered with?

From Dev

"The surface has been released" error

From Dev

Error: DbContext has been disposed

From Dev

Notify if data has been sent

From Dev

Django admin encoding error

From Dev

Ensuring JavaScript hasn't been tampered with

Related Related

  1. 1

    Django admin error ValidationError: [u'ManagementForm data is missing or has been tampered with']

  2. 2

    django ValidationError: u'ManagementForm data is missing or has been tampered with'

  3. 3

    ManagementForm data is missing or has been tampered with

  4. 4

    How to verify that a URL parameter has not been tampered with?

  5. 5

    ManagementForm Data is Missing When Using Formset Prefix

  6. 6

    SQL Server installation is either corrupt or has been tampered with error getting instance id from name

  7. 7

    Django Admin ValidationError on save with inlines

  8. 8

    SQL Server 2012: A way to see if the database has been tampered with?

  9. 9

    django_admin_log has not been created for me

  10. 10

    Resolving ValidationError: [u"'' value has an invalid date format. It must be in YYYY-MM-DD format."] in Django 1.9.2?

  11. 11

    Django DateTimeField ValidationError: value has an invalid format

  12. 12

    django - Missing fields in the admin

  13. 13

    django admin missing records

  14. 14

    Newrelic error in Django : Configuration has already been done

  15. 15

    The field was declared on serializer , but has not been included error in django rest

  16. 16

    New user signup causing error in admin view - ?missing data

  17. 17

    u' admin' is not a registered namespace in django

  18. 18

    Sending error response to socket after data has been writen

  19. 19

    The ConnectionString property has not been initialized Error during inserting data to Database

  20. 20

    What can cause a sporadic "-2147352567 The data has been changed" error?

  21. 21

    Error with reformatting the way data has been passed into a function

  22. 22

    Django raise Validationerror leads to Valuetype Error

  23. 23

    Rails admin "username has already been taken"

  24. 24

    How can I prove to an outside party that a data file hasn't been tampered with?

  25. 25

    "The surface has been released" error

  26. 26

    Error: DbContext has been disposed

  27. 27

    Notify if data has been sent

  28. 28

    Django admin encoding error

  29. 29

    Ensuring JavaScript hasn't been tampered with

HotTag

Archive