mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
Update rest_framework/validators.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
This commit is contained in:
parent
1f3caf5f71
commit
3dbb45dc4b
|
@ -235,10 +235,12 @@ class UniqueForDateValidator(BaseUniqueForValidator):
|
||||||
value = attrs[self.field]
|
value = attrs[self.field]
|
||||||
date = attrs[self.date_field]
|
date = attrs[self.date_field]
|
||||||
|
|
||||||
filter_kwargs = {field_name: value,
|
filter_kwargs = {
|
||||||
f'{date_field_name}__day': date.day,
|
field_name: value,
|
||||||
f'{date_field_name}__month': date.month,
|
f'{date_field_name}__day': date.day,
|
||||||
f'{date_field_name}__year': date.year}
|
f'{date_field_name}__month': date.month,
|
||||||
|
f'{date_field_name}__year': date.year
|
||||||
|
}
|
||||||
return qs_filter(queryset, **filter_kwargs)
|
return qs_filter(queryset, **filter_kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user