Opened 7 years ago

Closed 7 years ago

Last modified 5 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: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 7 years ago.
list_editable.2.diff (3.7 KB) - added by Antti Kaihola 7 years ago.
fixed whitespace strangeness in tests.py diff, updated for trunk@10675

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by Tom Novelli

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Sorry, that should be:

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

comment:2 Changed 7 years ago by Alex Gaynor

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

Can you post the full traceback?

comment:3 Changed 7 years ago by Alex Gaynor

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

Changed 7 years ago by Alex Gaynor

Attachment: list-editable.diff added

comment:4 Changed 7 years ago by Alex Gaynor

Has patch: set

Changed 7 years ago by Antti Kaihola

Attachment: list_editable.2.diff added

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

comment:5 Changed 7 years ago by Alex Gaynor

Resolution: fixed
Status: newclosed

Fixed in r10681.

comment:6 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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