#NEWLINE# def name( self , obj , time_field = 'created' ) : #NEWLINE# #INDENT# ct = ContentType . objects . get_for_model ( obj ) #NEWLINE# if ( self . type == self . _TYPE_COUNTER ) : #NEWLINE# #INDENT# date = None #NEWLINE# number = self . get_object ( ct ) #NEWLINE# if self . lookup : #NEWLINE# #INDENT# counter = ( obj . _base_manager . filter ( ** self . lookup ) . count ( ) + number . counter ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# counter = obj . pk #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# date = self . from_time ( getattr ( obj , time_field ) ) #NEWLINE# number = self . get_object ( ct , date ) #NEWLINE# lookup = self . lookup #NEWLINE# lookup . update ( { #NEWLINE# #INDENT# ( '%s__gte' % time_field ) : number . period_start , #NEWLINE# 'pk__lt' : obj . pk , #NEWLINE# #UNINDENT# } ) #NEWLINE# counter = ( obj . _base_manager . filter ( ** lookup ) . count ( ) + number . counter ) #NEWLINE# #UNINDENT# return self . generate_name ( date , counter )