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

Fixed #24698 and #24712: Implement get_db_prep_value for ForeignKey #4644

Closed
wants to merge 1 commit into from

Conversation

abhaga
Copy link

@abhaga abhaga commented May 11, 2015

ForeignKey was not deferring to related field for get_db_prep_lookup. As a result, the db_prep_save value would differ from db_prep_lookup value for foreign keys pointing to fields that implement a custom get_db_prep_value.

Add a tests checking specifically for a ForeignKey to a UUIDField.

@abhaga abhaga force-pushed the ticket_24698_24712_1_8 branch 2 times, most recently from df02a65 to da38886 Compare May 12, 2015 05:14
@timgraham
Copy link
Member

I think it would be better to add tests for the failing queries rather than the lower level implementation details -- tests/model_fields/test_uuid.py is where tests for similar fixes have been added in the past (reusing existing models also keeps the test suite simpler and faster). A mention in the 1.8.2 release notes is also appropriate.

@abhaga
Copy link
Author

abhaga commented May 12, 2015

I thought of that but then decide to go with testing the common cause linking the two tickets this solves.

Should I include tests based on the queries from both the tickets? Despite looking different on the face, they go through the same code path in the end - generating a where clause on a related field point to a UUIDField. The example in 24712 is quite minimal. So perhaps including only that one should suffice?

@timgraham
Copy link
Member

No strong opinion from me. I guess we'll need to add new models either way.

@abhaga abhaga force-pushed the ticket_24698_24712_1_8 branch 3 times, most recently from 4fd339c to 77f3633 Compare May 12, 2015 21:39
…ignKey

Due to missing get_db_prep_value on ForeignKey, UUIDField was
generating the wrong lookup values in db queries.

Tests for ForiegnKeys to models with UUIDField primary key
@abhaga
Copy link
Author

abhaga commented May 12, 2015

buildbot, test this please.

@timgraham
Copy link
Member

merged in 290c9d6 after some light edits, thanks!

@timgraham timgraham closed this May 12, 2015
@abhaga
Copy link
Author

abhaga commented May 13, 2015

Thanks!

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.

2 participants