Thursday, March 1, 2012

How can I use order_by and filter at the same time? (drives me nuts..!!!)

How can I use order_by and filter at the same time? (drives me
nuts..!!!)

This is what i tried:

from django.shortcuts import render_to_response
from vidupdate.posts.models import Entry
from datetime import datetime #( I even imported the date only)


def entry_view(request):
entries = Entry.objects.all().filter(posted.date ==
today).order_by('pushes')

def entry_view(request):
entries =
Entry.objects.all().filter(date.today()).order_by('pushes')

def entry_view(request):
entries =
Entry.objects.all().filter(datetime.date.today()).order_by('pushes')


I think I am wrong at the .filter()...
Thanks 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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment