<s> from django . db . models import Manager <EOL> from django . db import models <EOL> from django . utils import timezone <EOL> class PublishableQuerySet ( models . query . QuerySet ) : <EOL> def all_published ( self ) : <EOL> return self . filter ( ** self . get_all_published_lookups ( ) ) <EOL> def get_all_published_lookups ( self , prefix = "<STR_LIT>" ) : <EOL> return { <EOL> '<STR_LIT>' % prefix : timezone . now ( ) , <EOL> '<STR_LIT>' % prefix : True , <EOL> } <EOL> class PublishableManager ( Manager ) : <EOL> queryset_class = PublishableQuerySet <EOL> def get_query_set ( self ) : <EOL> return self . queryset_class ( self . model ) <EOL> def all_published ( self ) : <EOL> return self . get_query_set ( ) . all_published ( ) <EOL> def get_all_published_lookups ( self , prefix = "<STR_LIT>" ) : <EOL> return self . get_query_set ( ) . get_all_published_lookups ( prefix ) </s>
