Re: Best way of getting objects within a certain date range (method or manager)?

2008-06-30 Thread [EMAIL PROTECTED]
That was it. Thanks! On Jun 30, 9:59 am, Matt <[EMAIL PROTECTED]> wrote: > On Jun 30, 8:36 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > It sounds like I'm using "event_date" without defining it first. But > > the examples in the Django documentation do the same thing. What am I > >

Re: Best way of getting objects within a certain date range (method or manager)?

2008-06-30 Thread Matt
On Jun 30, 8:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > It sounds like I'm using "event_date" without defining it first. But > the examples in the Django documentation do the same thing. What am I > doing wrong? Try: super(CurrentManager,

Re: Best way of getting objects within a certain date range (method or manager)?

2008-06-30 Thread [EMAIL PROTECTED]
Yes, it sounds like a custom manager will do the job. Here's what I added: class CurrentManager(models.Manager): def get_query_set(self): return super(CurrentManager, self).get_query_set().filter(event_date > datetime.date.today()) class Event(models.Model):

Re: Best way of getting objects within a certain date range (method or manager)?

2008-06-30 Thread bruno desthuilliers
On 30 juin, 14:53, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm wanting to display only current (vs. expired) calendar events via > my Django events app. Each event has a date that it will occur. But > I'm not sure of the best method to get only the current events in the > db. > >

Best way of getting objects within a certain date range (method or manager)?

2008-06-30 Thread [EMAIL PROTECTED]
I'm wanting to display only current (vs. expired) calendar events via my Django events app. Each event has a date that it will occur. But I'm not sure of the best method to get only the current events in the db. Current events are those whose date is less than or equal to the present date. They