From dbac145638758413b966c3418fa5f3f651e3e02a Mon Sep 17 00:00:00 2001 From: amansharma612 Date: Mon, 18 Nov 2024 17:13:53 +0530 Subject: [PATCH] Removed extra <> in validators example (#9590) Co-authored-by: Aman Sharma <210100011@iitb.ac.in> --- docs/api-guide/validators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index e181d4c61..b1f58ef23 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -48,7 +48,7 @@ If we open up the Django shell using `manage.py shell` we can now CustomerReportSerializer(): id = IntegerField(label='ID', read_only=True) time_raised = DateTimeField(read_only=True) - reference = CharField(max_length=20, validators=[]) + reference = CharField(max_length=20, validators=[UniqueValidator(queryset=CustomerReportRecord.objects.all())]) description = CharField(style={'type': 'textarea'}) The interesting bit here is the `reference` field. We can see that the uniqueness constraint is being explicitly enforced by a validator on the serializer field.