Opened 9 years ago

Closed 9 years ago

#5693 closed (duplicate)

ForeignKey + edit_inline + primary_key breaks django

Reported by: andraz@… Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


ForeignKey + edit_inline + primary_key breaks django.

class DjangoX(models.Model):

id = models.AutoField(primary_key=True)
str1 = models.CharField(max_length = 10)
class Admin:


class DjangoY(models.Model):

article = models.ForeignKey( DjangoX,

primary_key = True,
raw_id_admin = True)

str2 = models.CharField(max_length = 10, core = True)
class Admin:


Then go to admin, create new object DjangoX, str1 = "something", leave str2 empty. Then click "edit" again and just press save.

You get KeyError:
KeyError at /admin/tee/djangox/1/
Request Method: POST
Request URL: http://localhost:8000/admin/tee/djangox/1/
Exception Type: KeyError
Exception Value: 'article'
Exception Location: /home/minmax/zdev/django/db/models/ in save, line 166
Python Executable: /usr/bin/python
Python Version: 2.4.4

Version: 0.97-pre-SVN-6456, this is the first version tested, i haven't tried if it works in 0.96

Change History (1)

comment:1 Changed 9 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Feels like a duplicate of #1603, which in turn seems to be a subset of #2434.

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