#35377: Add new validators for Date fields in serializers
------------------------------------------------+------------------------
               Reporter:  Jasurbek Yuldoshev    |          Owner:  nobody
                   Type:  New feature           |         Status:  new
              Component:  Core (Serialization)  |        Version:  5.0
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 I often see that validating date fields is quite repetitive, for example
 like this:

 {{{
 def validate_expiration_date(self, value: date) -> date:
         if value <= timezone.now().date():
             raise serializers.ValidationError("Expiration Date must be in
 future")

         return value
 }}}

 I thought maybe it would be good to have such validation rules out of the
 box of Django, such as `FutureDateValidator()`, `PastDateValidator()`.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35377>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ee2712fde-d65eebec-b742-48bf-b231-0fd955f9e249-000000%40eu-central-1.amazonses.com.

Reply via email to