I want a Django model to have a date field in which the year, month, and day are all optional. An example value could be as generic as 2008 or as specific as May 10, 2008. Is it possible to define a DateField to behave this way? Or am I better off defining year/month/day as separate integers, like this?
model Book(models.Model):
publication_year = models.IntegerField(blank=True, null=True)
publication_month = models.IntegerField(blank=True, null=True)
publication_day = models.IntegerField(blank=True, null=True)
The django-date-extensions at https://github.com/dracos/django-date-extensions (by me, for exactly for this purpose) includes an ApproximateDate object to handle dates that might not have a month or a day.