Re: Query Posts By Date

2010-05-30 Thread greg
Amazingly simple yet exactly what I wanted. And here I was trying to
convert year and month into date objects. Thank you.

On May 30, 10:19 pm, Justin Myers  wrote:
> If you're passing a "year" and "month" variable, I would use
> Post.objects.filter(publish_date__year=year,
> publish_date__month=month).
> -Justin
>
> On May 30, 12:34 am, greg  wrote:
>
> > Hello,
>
> > I'm (almost) done coding up my blog in Django.
>
> > Right now I'm working to implement a search by date function. So my
> > class Post has a DateTimeField() called publish_date.
>
> > For the date search, I want to put two dropdown boxes on the web-page
> > so the users can pick a Month and Year and then it will show all posts
> > from that month and year.
>
> > The trouble is... how I translate the selections from the listboxes
> > (i.e. May 2010) into a DateTimeField() so I can search for all the
> > posts from that month and year?
>
> > Or am I going about this all wrong?
>
> > Thanks for the help in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Query Posts By Date

2010-05-30 Thread Justin Myers
If you're passing a "year" and "month" variable, I would use
Post.objects.filter(publish_date__year=year,
publish_date__month=month).
-Justin

On May 30, 12:34 am, greg  wrote:
> Hello,
>
> I'm (almost) done coding up my blog in Django.
>
> Right now I'm working to implement a search by date function. So my
> class Post has a DateTimeField() called publish_date.
>
> For the date search, I want to put two dropdown boxes on the web-page
> so the users can pick a Month and Year and then it will show all posts
> from that month and year.
>
> The trouble is... how I translate the selections from the listboxes
> (i.e. May 2010) into a DateTimeField() so I can search for all the
> posts from that month and year?
>
> Or am I going about this all wrong?
>
> Thanks for the help in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Query Posts By Date

2010-05-30 Thread greg
Hello,

I'm (almost) done coding up my blog in Django.

Right now I'm working to implement a search by date function. So my
class Post has a DateTimeField() called publish_date.

For the date search, I want to put two dropdown boxes on the web-page
so the users can pick a Month and Year and then it will show all posts
from that month and year.

The trouble is... how I translate the selections from the listboxes
(i.e. May 2010) into a DateTimeField() so I can search for all the
posts from that month and year?

Or am I going about this all wrong?

Thanks for the help in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.