Skip to content

When using autocomplete field, object created with "Add Another" is not editable. #478

Open
@juliecampbell

Description

@juliecampbell

I have two models, ProductSpecs and Product. Product has a foreign key relationship to ProductSpecs, and on the admin page for Product, ProductSpecs is the field using autocomplete.

Here are the actions I take in the admin backend:

  1. Create a new Product. (This is not reproducible when editing an existing Product.)
  2. Click "Add Another" for ProductSpecs. The popup for ProductSpecs appears as expected.
  3. Fill out the fields for ProductSpecs. Click save in the popup. The popup closes as expected and the ProductSpecs field is filled out with the correct ProductSpecs object.

If after this point I click save on the Product, everything is created and works as expected.

The problem is if I have not yet clicked save on the new product, but instead click to edit the newly created ProductSpecs object, the popup contains a 404. The error message given in my local environment is "Product Specs object with primary key u'null' does not exist.". This is also reproducible with a different foreign key relationship elsewhere in my project (which is the only other place I am using autocomplete fields).

If I let the ProductSpecs field on the Products admin page be the default Django foreign key select dropdown, this error does not happen.

As this is the first time I have used this plugin, it is entirely possible that I haven't set something up right. I have not dug deeply into the plugin functionality yet and have only used the basic install and tutorial information. Does it sound like I am missing something, or does this sound like a bug?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions