#NEWLINE# def handle_model( self ) : #NEWLINE# #INDENT# self . model . add_to_class ( 'publication_date' , models . DateTimeField ( _ ( 'publication date' ) , default = granular_now ) ) #NEWLINE# self . model . add_to_class ( 'publication_end_date' , models . DateTimeField ( _ ( 'publication end date' ) , blank = True , null = True , help_text = _ ( 'Leave empty if the entry should stay active forever.' ) ) ) #NEWLINE# self . model . add_to_class ( 'latest_children' , latest_children ) #NEWLINE# orig_save = self . model . save #NEWLINE# def granular_save( obj , * args , **kwargs ) : #NEWLINE# #INDENT# if obj . publication_date : #NEWLINE# #INDENT# obj . publication_date = granular_now ( obj . publication_date ) #NEWLINE# #UNINDENT# if obj . publication_end_date : #NEWLINE# #INDENT# obj . publication_end_date = granular_now ( obj . publication_end_date ) #NEWLINE# #UNINDENT# orig_save ( obj , * args , ** kwargs ) #NEWLINE# #UNINDENT# self . model . save = granular_save #NEWLINE# if hasattr ( granular_save . model . _default_manager , 'add_to_active_filters' ) : #NEWLINE# #INDENT# self . model . _default_manager . add_to_active_filters ( ( lambda queryset : queryset . filter ( ( Q ( publication_date__lte = granular_now ( ) ) & ( Q ( publication_end_date__isnull = True ) | Q ( publication_end_date__gt = granular_now ( ) ) ) ) ) ) , key = 'datepublisher' ) #NEWLINE# #UNINDENT# self . model . register_response_processor ( datepublisher_response_processor )