Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix primary key import issue, add test #1853

Conversation

roharvey
Copy link
Contributor

@roharvey roharvey commented May 23, 2024

Problem

Closes #1852

Solution

Replaced id reference with pk

Acceptance Criteria

I wrote a test, probably very poorly so please update or advise on changes. The test failed before the widget.py change and passed afterwards.
After the fix was in place, using the test app and following the steps in the ticket, I got past the error:
image

Copy link
Contributor

@matthewhegarty matthewhegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for raising this and crafting a fix, much appreciated 👍

I have refactored to use classes from the example application, I hope that's ok with you.

Feel free to add your name to AUTHORS if you wish.

@coveralls
Copy link

coveralls commented May 24, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling bb8d6b6 on roharvey:issue-1852-related-primary-key-import
into 5f66a65 on django-import-export:main.

@roharvey
Copy link
Contributor Author

Thanks so much for raising this and crafting a fix, much appreciated 👍

I have refactored to use classes from the example application, I hope that's ok with you.

Feel free to add your name to AUTHORS if you wish.

Thanks! Yes much better test, I figured I was barking up the wrong tree. I added myself to AUTHORS and appreciate your responsiveness!

One little thing... it looks like a test for #1846 (test_declared_field_export_order()) made its way into this PR. Not that it bothers me, but I wondered if that was intentional?

@matthewhegarty
Copy link
Contributor

I will merge soon once tests complete. Thanks for all your input on this PR.

it looks like a test for #1846 (test_declared_field_export_order()) made its way into this PR.

I think that is because I merged the new test in a separate PR. If you pull and merge from upstream it should fix it. The test isn't showing in this PR's changes so it should be ok.

@matthewhegarty matthewhegarty merged commit c22a340 into django-import-export:main May 27, 2024
13 checks passed
@PetrDlouhy
Copy link
Contributor

@matthewhegarty I think there is typo in the code. The commit description states [test for Resource export order with declared fields (1868), but the comment in the commit points to #1846.

@roharvey roharvey deleted the issue-1852-related-primary-key-import branch June 4, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Related model with primary key causes import exception (regression)
4 participants