Jay Parlar wrote:
> I posted this on django-users,  but didn't get much feedback. It seems
> like a pretty important problem, so I'm reposting here:
> 
> My current model looks like this:
> 
> class Article(models.Model):
>    title = models.CharField(maxlength=64)
>    slug = models.SlugField(prepopulate_from=("title",))
>    author = models.ForeignKey(User)
>    text = models.TextField()
>    pub_date = models.DateField()
>    public = models.BooleanField()
>
 > <snip/>
> 
> As an example, I created an entry in the Admin with a Date of
> 2006-01-16 and a slug of "foo". 
 >
 > <snip/>
> ln [14]:x = Article.objects.all()
> 
> In [15]:x.filter(pub_date__range= (datetime.datetime(2006,1,16,0,0),
> datetime.datetime(2006,1,16,23,59,59,999999)))
> Out[15]:[]
> 
> In [16]:x.filter(pub_date__range=
> (datetime.datetime(2006,1,15,23,59,59,999999),
> datetime.datetime(2006,1,16,0,0,0,0)))
> Out[16]:[<Article: foo bar blah>]
 >
 > <snip/>
> 
> Note, I'm using sqlite3.
> 

that seems to be the problem.
it works with postgresql.

if you want to verify the problem:

import django.db
print django.db.connection.queries

this will print out the sql queries django is doing.

in this case it does something like this:

select * from main_article where pub_date between '2006-01-16 00:00:00' 
AND '2006-01-16 23:59:59.999999';

if you execute this query directly on the sqlite3 database, it will not 
find anything.

if you repeat this example in postgresql, it works.

so it seems to be a bug with sqlite3... will dig around a little more.

gabor

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to