Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10893 closed (fixed)

list_editable breaks when primary_key=True in model

Reported by: Tom Novelli Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Error message: Caught an exception while rendering: "Key 'iso' not found in Form"

Django version 1.1 beta 1 SVN-10620

Code:

class Language(models.Model):
    iso          = models.CharField(max_length=5, primary_key=True)
    name         = models.CharField(max_length=50)
    english_name = models.CharField(max_length=50)
    shortlist    = models.BooleanField(default=False)

class LanguageAdmin(admin.ModelAdmin):
    list_display = ['iso', 'shortlist', 'english_name', 'name']

admin.site.register(Language, LanguageAdmin)

Attachments (2)

list-editable.diff (5.2 KB ) - added by Alex Gaynor 16 years ago.
list_editable.2.diff (3.7 KB ) - added by Antti Kaihola 16 years ago.
fixed whitespace strangeness in tests.py diff, updated for trunk@10675

Download all attachments as: .zip

Change History (8)

comment:1 by Tom Novelli, 16 years ago

Sorry, that should be:

class LanguageAdmin(admin.ModelAdmin):
    list_display = ['iso', 'shortlist', 'english_name', 'name']
    list_editable = ['shortlist']

comment:2 by Alex Gaynor, 16 years ago

Component: Uncategorizeddjango.contrib.admin
milestone: 1.1
Triage Stage: UnreviewedAccepted

Can you post the full traceback?

comment:3 by Alex Gaynor, 16 years ago

Ok, I've been able to reproduce, I'll have a patch shortly.

by Alex Gaynor, 16 years ago

Attachment: list-editable.diff added

comment:4 by Alex Gaynor, 16 years ago

Has patch: set

by Antti Kaihola, 16 years ago

Attachment: list_editable.2.diff added

fixed whitespace strangeness in tests.py diff, updated for trunk@10675

comment:5 by Alex Gaynor, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in r10681.

comment:6 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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