Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix unique_together validation with source#9482

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

yuekui
Copy link
Contributor

Thisfixed#9442
Fields with specified sources should now be handled correctly.
The unique together queryset with condition is another separated issue, which should be addressed in#9360

@auvipyauvipy self-requested a reviewJuly 30, 2024 06:03
Copy link
Member

@auvipyauvipy left a comment

Choose a reason for hiding this comment

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

hey thanks for the patch! whats your take on this comment#9442 (comment) ?

@@ -159,17 +159,18 @@ def __call__(self, attrs, serializer):
queryset = self.filter_queryset(attrs, queryset, serializer)
queryset = self.exclude_current_instance(attrs, queryset, serializer.instance)

checked_names = [
serializer.fields[field_name].source for field_name in self.fields
Copy link
Contributor

Choose a reason for hiding this comment

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

Since fields is a dict it is more readable to iterate over values, also it should be a little faster.

Suggested change
serializer.fields[field_name].sourceforfield_nameinself.fields
field.sourceforfieldinself.fields.values()

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hi@sevdog thanks for the comment, but I believeself.fields is a list of strings, not dict.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, sorry I was considering to be in an other class/file.

Copy link
Contributor

@kalekseevkalekseev left a comment

Choose a reason for hiding this comment

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

LGTM

@auvipyauvipy merged commit518eb22 intoencode:masterAug 5, 2024
7 checks passed
@tomchristie
Copy link
Member

@encode/maintainers One of the most important aspects for REST framework right now is a maintenance team who consistently push back on pull requests. (See pinned discussion#9130, and PR#9392)

In my view the churn and security issues associated with the 3.15 release and subsequent follow-ups clearly demonstrate that we need to draw a clear line here and stop accepting code pull requests, withabsolutely the only exceptions being CVE'ed security issues and changes in Django versions don't pass against our CI.

9128305 and auvipy reacted with thumbs up emojiauvipy reacted with confused emoji

@auvipyauvipy added the Bug labelAug 10, 2024
@auvipy
Copy link
Member

It a was a fix for a regression....

@mredaelli
Copy link

Fantastic! Thanks.

Would it be possible to have a release with this fix?

@NoeAzarGit
Copy link

Are there any plans to release this fix?

@mredaelli
Copy link

Sorry to bump again, but this is preventing us from upgrading and thus fixing a security advisory. Can you please do a release?

luca-drf and fizyk reacted with thumbs up emoji

@browniebrokebrowniebroke added this to the3.16 milestoneJan 16, 2025
gergosimonyi added a commit to goauthentik/authentik that referenced this pull requestApr 14, 2025
upgrade `django-rest-framework` to `3.16.0`The reverted commit is purely an optimization which unfortunately breaks authentik, specifically Blueprints. It adds `getattr(serializer.instance, field)` to a validator. If `field` is a `RelatedObject`, that invocation queries the database.When authentik creates objects using Blueprints, it doesn't place related objects into the database before the validator tries to get them from there, so with the reverted commit, it produces `RelatedObjectDoesNotExist`.Perhaps a long-term solution is to revise how Blueprints work, or perhaps it is to change upstream. But in the meantime, Django 5.0 support ended and upgrading to Django 5.1 requires an upgrade of `django-rest-framework` to `3.16.0`, hence this workaround.See-encode/django-rest-framework#9154-encode/django-rest-framework#9358-encode/django-rest-framework#9482-encode/django-rest-framework#9483
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sevdogsevdogsevdog left review comments

@kalekseevkalekseevkalekseev approved these changes

@auvipyauvipyauvipy approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
3.16
Development

Successfully merging this pull request may close these issues.

UniqueTogetherValidator does not work withsource kwarg
8 participants
@yuekui@tomchristie@auvipy@mredaelli@NoeAzarGit@kalekseev@sevdog@browniebroke

[8]ページ先頭

©2009-2025 Movatter.jp