On 3/12/07, Roland Hedberg <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have designed a model which contains among other things a couple of
> DateFields.
>
> Some, actually one, of these must have a value but the other may not.
>
> So, I tried to use the construct:
>
> done_planned = models.DateField(blank=True)
>
> But that doesn't work, because I get a exception with the error:
>
> "act_activity.done_planned may not be NULL"
>
> when trying to store a model instance where the optional dateField
> attributes are undefined.
>
> So, how should it be done ?


You want:

done_planned = models.DateField(blank=True, null=True)

'blank=True' is for the Admin, saying that at a validator level, the
field may be blank. 'null=True' is for the database constraints.

Jay P.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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