Thursday, March 31, 2011

Strange admin changelist bug with list_editable and FK to User in 1.2.3

Hi folks...

I've got a model that looks roughly like so:

class Account(admin.ModelAdmin):
type = models.ForeignKey(AccountType, help_text='Type of account.
Determines what features are available to the user.')
user = models.ForeignKey(User, unique=True, primary_key=True)
design = models.ForeignKey(Skin, blank=True, null=True)
....

And a ModelAdmin that looks like so:

class AccountAdmin(admin.ModelAdmin):
list_display = ['__unicode__', 'user', 'type', 'design', ...]
list_editable = ['type', 'design', ...]

The User column is showing up blank in the admin changelist
(containing nothing but a hidden form field). I've tried eliminating
other options on the AccountAdmin, changing field order, and narrowed
it down to some sort of odd interaction with list_editable.
Commenting out the list_editable property entirely fixes the problem,
but any value (even an empty list) for list_editable that does not
include 'user' causes the problem to recur.

Any idea what might be going on? I'm using 1.2.3 at the moment, and
the client doesn't want to authorize the work to upgrade to 1.3 just
yet, so I can't determine whether it's version-specific.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment