On 12/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> What is the best way to handle situation where I sometimes I know the
> exact date of an event, and sometimes I know only a less specific part?
>
> Recording date: 1972-10-15 (No problem)
>
> but when I only know the month, 1972-10, or the year 1972, admin throws
> a validation error.

Hi Dan,

In this case, your best bet is to use a different type of field. Even
if you changed the validation to be looser, the data for a DateField
still fundamentally needs to be a complete date (with month, day and
year) in order to fit in the database column. A database column of
type DATE cannot accept partially filled dates.

I'd suggest using a CharField instead. The downside to this is that
you can't take advantage of date-specific queries, such as retrieving
all the records where the date is in a certain month, but whether
that's a problem depends on your application.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to