How to use a Django validator to limit dates to 1900 or greater

I found this commit showing the _datere pattern now requires a date > 1900 but ... when I look into django.core.validators today I don't see anything like this (the commit linked to above does say it's from 7 years ago).

What happened to this validation in django and what are people using today in Django 1.4.1 to get this type of validation?

I'm asking this because of the strftime error:

"ValueError('year=1800 is before 1900; the datetime strftime() methods require year >= 1900',)"

Thank you!

Answers


@SimeonVisser gave a great explanation of the reason you used to get this exception and why you no longer do.

If still want dates greater than 1900 as business logic and not as an actual inherent limitation, you should be able to use the built-in Django MinValueValidator. Just feed it a date/datetime of 1900-01-01, i.e.

validators=[MinValueValidator(datetime(1900, 1, 1, 0, 0))]

Need Your Help

How do I dynamically access elements of a particular Div tag?

javascript javascript-events getelementsbytagname

This is my JavaScript's onMouseOver event handler for Div tags. (It works fine, in at least Chrome & IE):

Linq, select differences between two lists, select same between same list, and select duplicates same list

c# linq list merge equality

I want to know if it's possible in LINQ to achieve something along the lines of: