Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#10893 closed (fixed)

list_editable breaks when primary_key=True in model

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

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by tnovelli

  • 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 6 years ago by Alex

  • Component changed from Uncategorized to django.contrib.admin
  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

Can you post the full traceback?

comment:3 Changed 6 years ago by Alex

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

Changed 6 years ago by Alex

comment:4 Changed 6 years ago by Alex

  • Has patch set

Changed 6 years ago by akaihola

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

comment:5 Changed 6 years ago by Alex

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r10681.

comment:6 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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