Opened 9 years ago

Closed 9 years ago

#864 closed defect (fixed)

OneToOne in Admin -- unexpected keyword argument 'bar__pk'

Reported by: EABinGA Owned by: adrian
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using new-admin rev-1326:

Given the Model Foo:

from django.core import meta

# Create your models here.

class Bar(meta.Model):
    class META:
        admin = meta.Admin()
        
    bardata = meta.CharField(maxlength=200)
    
    def __repr__(self):
        return self.bardata
        
class Baz(meta.Model):
    class META:
        admin = meta.Admin()
        
    bazdata = meta.CharField(maxlength=200)
    bar = meta.OneToOneField(Bar)

    def __repr__(self):
        return self.bazdata

When you try to add a baz to a bar and click ¨save¨

You are greeted by the following:

TypeError at /admin/foo/bazs/1/
got unexpected keyword argument 'bar__pk'
Request Method: 	POST
Request URL: 	http://127.0.0.1:8080/admin/foo/bazs/1/
Exception Type: 	TypeError
Exception Value: 	got unexpected keyword argument 'bar__pk'
Exception Location: 	/usr/lib/python2.4/site-packages/Django-0.90-py2.4.egg/django/core/meta/__init__.py in _throw_bad_kwarg_error, line 1379

Aditionally: the list of bazs (http://127.0.0.1:8000/admin/foo/bazs/) has entries that disappear after
selecting a baz, they return if you restart the app. (Adrian though he may have fixed this, but it seems not to be the case)

Also: The user interface for entering a baz seems to be buggy. It shows a label of ¨ID¨ folowed by a dropdown list containing only the bar I would like to add a baz to, followed by what seems to be the PK of said bar.

Change History (1)

comment:1 Changed 9 years ago by EABinGA

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

The error seems to be fixed, there still is some text in the admin UI after the ¨select¨ element that should not be there though.

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