Skip to content

Conversation

@Vayel
Copy link
Contributor

@Vayel Vayel commented Aug 13, 2017

A test for #239. It fails.

The field with the unique_with parameter has a UniqueValidator in the serializer whereas it shouldn't.

TestSerializer():
    id = ObjectIdField(read_only=True)
    ref1 = ReferenceField(queryset=ReferencedDoc.objects, required=True, validators=[<UniqueValidator(queryset=ReferencedDoc.objects)>])
    ref2 = ReferenceField(queryset=OtherReferencedDoc.objects, required=True)
    class Meta:
        validators = [<UniqueTogetherValidator(queryset=ReferencingDocWithUniqueWithField.objects, fields=('ref1', 'ref2'))>]

Due to the UniqueValidator on ref1, Mongoengine tells use that ReferencedDoc has no field ref1.

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.

1 participant