<s> from django . db . models import Manager <EOL> from django . db . models import Sum <EOL> from django . db . models . query import QuerySet <EOL> class StoryQuerySet ( QuerySet ) : <EOL> def draft ( self ) : <EOL> return self . filter ( is_published = False ) <EOL> def published ( self ) : <EOL> return self . filter ( is_published = True ) <EOL> def featured ( self ) : <EOL> return self . published ( ) . filter ( featured = True ) <EOL> class StoryManager ( Manager ) : <EOL> def get_queryset ( self ) : <EOL> return StoryQuerySet ( self . model , using = self . _db ) <EOL> def draft ( self ) : <EOL> return self . get_queryset ( ) . draft ( ) <EOL> def published ( self ) : <EOL> return self . get_queryset ( ) . published ( ) <EOL> def featured ( self ) : <EOL> return self . get_queryset ( ) . featured ( ) <EOL> def featured_weight_total ( self ) : <EOL> amount = self . featured ( ) . aggregate ( total = Sum ( '<STR_LIT>' ) ) <EOL> if amount : <EOL> return amount [ '<STR_LIT>' ] <EOL> return <NUM_LIT:0> </s>
