Code

Opened 5 years ago

Closed 5 years ago

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

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 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 5 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 5 years ago by Alex

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

Changed 5 years ago by Alex

comment:4 Changed 5 years ago by Alex

  • Has patch set

Changed 5 years ago by akaihola

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

comment:5 Changed 5 years ago by Alex

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

Fixed in r10681.

comment:6 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.