Good idea Thomas. I'll experiment with using __range to get 24
individual records instead of retrieving all records and then looping
over the queryset. Thanks.
Graham

On Oct 15, 1:15 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> grahamu schrieb:> I'd like to find an efficient method to retrieve a list of 
> Django DB
> > records (model has a DateTimeField `timestamp`) between datetime
> > 'start' and datetime 'end' with a few conditions. First, we're looking
> > for a record once every 'interval' minutes. Second, I only want a
> > record if it's timestamp within 'fudge' minutes of the target time.
> > Last, if such a record doesn't exist for an interval, put None in the
> > list instead.
>
> The query api supports range searches, which result into SQL's BETWEEN:
>
> You can use datetime.timedelta(minutes=fudge_minutes) to compute the
> start and end times of your target time.
>
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#range
>
> On unix you would set up a cron-job which gets called very N minutes.
>
>  Does this help you?
>
>   Thomas
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~---------~--~----~------------~-------~--~----~
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