Jani is correct, you'll need to be careful to handle timezones if timezones 
are activated in SETTINGS. I can see value in a django-validators external 
package that you could expand upon with newer validators as they come up. 
But whether or not you want to build and maintain such a project is 
obviously up to you. I agree with Tim, that this feature would probably be 
better off as an external package, at least for the moment.

Thanks!

On Wednesday, 31 August 2016 17:31:11 UTC+10, Jani Tiainen wrote:
>
> Hi,
>
> As Tim pointed out this can easily live as an external package.
>
> Also you have to be really careful with dates and specially datetimes when 
> playing with timezones and daylight saving time. Specially since you 
> mention that invoice dates that may belong to past/present/future.
>
> On 30.08.2016 23:16, 'Mariano Baragiola' via Django developers 
> (Contributions to Django itself) wrote:
>
> Hello django-developers@, 
>
> On more than one project, I find myself implementing the same feature over
> and over again. It's not a rare case scenario, for instance: it's common
> that invoices have a date that belongs to the past or the present time, but
> not the future.
>
> Seeing that we have django.core.validators.MinValueValidator and
> django.core.validators.MaxValueValidator, I propose the following:
>
> * django.core.validators.DateIsPresent
> * django.core.validators.DateIsPresentOrPast
> * django.core.validators.DateIsPresentOrFuture
> * django.core.validators.DateIsFuture
>
> This way, one may easily use them at models.py just like MinValueValidator
> and MaxValueValidator.
>
> The code would be really simple, I have them -differently- implemented at:
> https://github.com/heimdalerp/heimdalerp/blob/master/common/validators.py
>
> Please, let me know if there's already an easier way to do this with
> current Django, or if this belongs to a custom app instead.
>
> If it is ok to add this feature to Django, I can gladly take care of it.
>
> Thanks in advance.  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/D6FE121C-FCA4-422C-8AF6-1E5BD87B091A%40yahoo.com
>  
> <https://groups.google.com/d/msgid/django-developers/D6FE121C-FCA4-422C-8AF6-1E5BD87B091A%40yahoo.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/99ddcb2e-4f50-42f3-8d45-ecee7b908f92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... 'Mariano Baragiola' via Django developers (Contributions to Django itself)
    • ... Tim Graham
    • ... Jani Tiainen
      • ... Josh Smeaton

Reply via email to