wip: non-integer primary keys#279
Draft
knokko wants to merge 3 commits into
Draft
Conversation
This commit dramatically improves the way binder handles non-integer primary keys. Currently, binder sort of allows it, but: - You cannot invoke detail endpoints - You cannot invoke detail routes - The name of the primary key field is always sent as `id` over the network, regardless of what the name of the primary key field is. - Any relations will fail miserably because binder accepts only integer IDs. This commit fixes all of these shortcomings.
Author
|
Note that filtering on foreign key is now handled by this code: # For foreign keys and similar fields, we should use the filter of the primary key of the related object
class_for_filtering = field.__class__
if isinstance(field, models.ForeignObject) or isinstance(field, models.ManyToManyField) or isinstance(field, models.ForeignObjectRel):
class_for_filtering = field.related_model._meta.pk.__class__Prior to this PR, it was hardcoded as part of |
Before updating django-hijack, the /user/endmasquerade/ endpoint would yield 200 when it succeeds, and yield 403 when it fails because the user is not masquerated. After updating django-hijack, it would always yield 200. This commit restores the old behavior of returning 403 for non-masquerated users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves support for non-integer primary keys
Currently, binder sort of allows it, but:
idover the network,regardless of what the name of the primary key field is.
This PR fixes all of these shortcomings.
Furthermore, it fixes some history changeset inconsistencies.