Opened 17 years ago

Closed 17 years ago

#5693 closed (duplicate)

ForeignKey + edit_inline + primary_key breaks django

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

Description

ForeignKey + edit_inline + primary_key breaks django.

Testcase:
class DjangoX(models.Model):

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

pass

class DjangoY(models.Model):

article = models.ForeignKey( DjangoX,

unique=True,
edit_inline=models.STACKED,
num_in_admin=1,
min_num_in_admin=1,
max_num_in_admin=1,
num_extra_on_change=0,
primary_key = True,
raw_id_admin = True)

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

pass

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/
'article'
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/manipulators.py 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 by James Bennett, 17 years ago

Resolution: duplicate
Status: newclosed

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