Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#18568 closed Bug (needsinfo)

django admin interface not behaving properly in firefox.

Reported by: chs2048@… Owned by: Chris2048
Component: contrib.admin Version: 1.3-rc
Severity: Normal Keywords: django firefox IE admin
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

I have a simple Django app that connects to a database and allows me to administrate it.

It consists of a few models, and some inlines, but little else other than Django.

but I'm getting strange behavior when using firefox 13.0.1 (IE 8.0 works).

for the following inlines:

class UserRoleClientMembershipInline(admin.TabularInline):
    model = UserRoleClientMembership
    extra = 1

class UserRoleClientGroupMembershipInline(admin.TabularInline):
    model = UserRoleClientGroupMembership
    extra = 1

class UserAdmin(admin.ModelAdmin):
    inlines = [UserRoleClientMembershipInline, UserRoleClientGroupMembershipInline]

admin.site.register(User, UserAdmin)

where the model 'user' is:

class User(models.Model):
    user_name = models.CharField(max_length=1024)
    roles = models.ManyToManyField(Role, through='UserRoleClientMembership')
    def __unicode__(self):
        return self.user_name
    class Meta:
        db_table = u'users'

When I try to add any user I get:

ValidationError at <url>
[u'ManagementForm data is missing or has been tampered with']

Also, when I remove the second inline, adding users works, but if I enter incomplete data in the first inline, firefox doesn't always give a (second field required) like IE does, it just ignores the inline instead. At other times, firefox *has* added new users, and has displayed the field-required warning.

I should note that I'm running Django ontop of Jython ontop of tomcat6 (which has caused problems before), but in this case I'm curious as to why IE works correctly.

Thanks.

Change History (4)

comment:1 by Chris2048 <chs2048@…>, 12 years ago

Chrome 20.0 also works.

comment:2 by Julien Phalip, 12 years ago

I'm afraid I can't reproduce this. Your code samples were incomplete so I've made some guesses and used the following:

# models.py

from django.db import models

class Role(models.Model):
    name = models.CharField(max_length=255)

class Group(models.Model):
    name = models.CharField(max_length=255)

class UserRoleClientGroupMembership(models.Model):
    group = models.ForeignKey('Group')
    user = models.ForeignKey('User')

class UserRoleClientMembership(models.Model):
    role = models.ForeignKey('Role')
    user = models.ForeignKey('User')

class User(models.Model):
    user_name = models.CharField(max_length=1024)
    roles = models.ManyToManyField(Role, through='UserRoleClientMembership')
    def __unicode__(self):
        return self.user_name


# admin.py

from django.contrib import admin
from models import *

class UserRoleClientMembershipInline(admin.TabularInline):
    model = UserRoleClientMembership
    extra = 1

class UserRoleClientGroupMembershipInline(admin.TabularInline):
    model = UserRoleClientGroupMembership
    extra = 1

class UserAdmin(admin.ModelAdmin):
    inlines = [UserRoleClientMembershipInline, UserRoleClientGroupMembershipInline]

admin.site.register(User, UserAdmin)

Could you please provide more specific code samples and instructions to reproduce the problem?

comment:3 by Aymeric Augustin, 12 years ago

Resolution: needsinfo
Status: newclosed

comment:4 by Chris2048, 12 years ago

Ok, I managed to fix it.

The issue was that the multipart/form-data packets didnd't contain all the form fields (as verified by wire-shark),
the data was missing for some reason. It was also the case that the data seem to be cut off at a certain point (the issue only arose on pages with lots of fields).

Infact, it was the fact I was running Django-on-Jython on top of tomcat as described here.

There is already a ticket for this, #13756,
and a bug on the jython bugtracker, issue1754

Thank you for you attention.

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