Skip to content

Instantly share code, notes, and snippets.

@idan
Created September 24, 2009 23:35
Show Gist options
  • Save idan/193137 to your computer and use it in GitHub Desktop.
Save idan/193137 to your computer and use it in GitHub Desktop.
# urls.py
object_list_dict = {
'queryset': Post.objects.published(),
'paginate_by': 20,
}
# managers.py
class PublicManager(Manager):
def published(self):
return self.get_query_set().filter(public=True, published__lte=datetime.datetime.now())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment