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

5.0: Update django.db.models.constraints.UniqueConstraint #2175

Merged

Conversation

steve148
Copy link
Contributor

I have made things!

Adds in nulls_distinct field to the UniqueConstraint class. Field can be None or a boolean.

https://docs.djangoproject.com/en/5.0/ref/models/constraints/#nulls-distinct

Related issues

Refs #1493

Feedback

None from me. Let me know if I missed anything.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

@steve148 steve148 force-pushed the feat/unique-constraint-nulls-distinct branch 2 times, most recently from 8a811fb to 5e5817c Compare May 21, 2024 14:31
@steve148
Copy link
Contributor Author

@sobolevn I amended the change, let me know if this is what you meant. I added the attribute to the class so it shows up as an arg on both the init and as an instance attribute. I also added a quick test to make sure it works.

@steve148 steve148 marked this pull request as ready for review May 21, 2024 14:33
@JaeHyuckSa JaeHyuckSa mentioned this pull request May 21, 2024
39 tasks
Reflects the nulls_distinct option of the UniqueConstraint class. Adds
the attribute and the arg to the two versions of the __init__ type
definitions.

https://docs.djangoproject.com/en/5.0/ref/models/constraints/#nulls-distinct
@steve148 steve148 force-pushed the feat/unique-constraint-nulls-distinct branch from 5e5817c to b24240e Compare May 21, 2024 17:01
@sobolevn sobolevn merged commit 5218b4f into typeddjango:master May 21, 2024
36 checks passed
@steve148 steve148 deleted the feat/unique-constraint-nulls-distinct branch May 21, 2024 18:11
@LaurierMantel
Copy link

This is big - thank you @steve148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants