-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Fix raising on nullable fields part of UniqueConstraint
#9531
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix raising on nullable fields part of UniqueConstraint
#9531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any progress here?
Not really, I've dropped the ball a bit on this one. Will try to make some progress... |
Is a new version expected with this fix and others related like #9360 ? The support for UniqueConstraint is not complete and may cause issues… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks! |
I'm not entirely sure under which circumstances, but this change turns a I'll keep investigating. |
Here is a (minimal???) reproducer: def test_tba():
class TestModel(models.Model):
field_1 = models.IntegerField(null=True)
field_2 = models.IntegerField(null=True)
class Meta:
unique_together = (("field_1", "field_2"),)
class TestSerializer(serializers.ModelSerializer):
field_1 = serializers.SerializerMethodField()
def get_field_1(self) -> str:
return "TEST"
class Meta:
model = TestModel
fields = ["field_1", "field_2"]
fields = TestSerializer().fields
assert isinstance(fields["field_1"], serializers.SerializerMethodField)
|
Description
Fix #9378