On 2 Mar 2010, at 16:55 , Chris McComas wrote:
>
> One more question...I'm trying in my view to say if the deadline has
> passed to make that field as True, if not False
>
> I have this view: http://dpaste.com/166951/
>
> This is the error I get:
>
> http://dpaste.com/166952/
>
> On Mar 2, 10:12 am, C
At the top of your file, did you do `from datetime import datetime` or
just `import datetime`? I expect it's the former.
Also:
* You probably want to use `datetime.date.today()`, not
`datetime.datetime.now()` given your field is a DateField, not a
DateTimeField.
* I'd use the test "<" (or "<=") instead of ">" ("the deadline is before today")
* You can give the result of that test directly to your variable:
admit.deadline_passed = admit.deadline < date.today()
* Finally, deadline_passed has no reason to be stored in the DB (unless it's a
perf
bottleneck, but I highly doubt that one), why store it in a field?
--
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.