Hi Darthmahon, You probably want "from datetime import datetime" at the top, as now() is buried a bit deeper into the module tree than you'd expected.
That said, isn't your query going to return everything that's happening at the very instant the query is run? You probably want something like: from datetime impot date today = date.today() Event.objects.filter(date__year = today.year, date__month = today.month, date__day = today.day) Hope this helps, Alex Darthmahon wrote: > Hey, > > I want to get a list of events that are happening today and I'm using > this query: > > Event.objects.filter(date__exact=datetime.now()) > > Simple enough, but it throws up this error: > > AttributeError at /events/today/ > 'module' object has no attribute 'now' > > My model looks like this: > > title = models.CharField(maxlength=200) > slug = models.SlugField(prepopulate_from=('title',)) > body = models.TextField() > created = models.DateTimeField(auto_now_add=True) > date = models.DateField() > time = models.TimeField() > > Any ideas? I'm importing datetime at the top of my views.py file > (where the query is run). > > Cheers, > Chris > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---