Thank you both a lot! I knew it was simple, not sure why I couldn't figure it out.
Thanks! On Sat, Sep 13, 2008 at 12:55 PM, Keith Eberle <[EMAIL PROTECTED]>wrote: > Building on Marcelo's response, and an example from James Bennett's book > (Ch 5), you could also add a custom manager. It'd go something like this: > > class PublishedEntryManager(models.Manager): > def get_query_set(self): > return super(PublishedEntryManager, > self).get_query_set().filter(pub_date__lte=datetime.now()) > > class Entry(models.Model) > title = ...etc... > content = ...etc... > objects = models.Manager() > published = PublishedEntryManager > > Entry.published.all() will return a queryset of all published Entries. > > keith > > > On Fri, Sep 12, 2008 at 3:12 AM, Marcelo Ramos <[EMAIL PROTECTED]> wrote: > >> >> 2008/9/12 Dana <[EMAIL PROTECTED]>: >> > >> > Hey all, >> > >> > Wondering what the best technique would be to make sure that an entry >> > (such as a blog entry/story/etc...) with a datetime object 'pub_date' >> > does not show up on the front end if the pub_date is in the future. I >> > would assume using ".filter(...something...)" is the way to go but >> > what would be the best filter to apply? Any other ways to achieve >> > this? >> >> Yes, a filter is a good option. For example: >> >> from datetime import datetime >> >> .objects.filter(pub_date__lte=datetime.now()) >> >> Regards. >> >> -- >> Marcelo Ramos >> >> >> > > > > -- Dana Woodman http://www.organixdesign.com/ [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---