#NEWLINE# def validate_long_slug( self ) : #NEWLINE# #INDENT# self . _create_mpath_long_slug ( ) #NEWLINE# filters = dict ( long_slug = self . long_slug ) #NEWLINE# if self . id : #NEWLINE# #INDENT# filters [ 'id__ne' ] = self . id #NEWLINE# #UNINDENT# exist = self . __class__ . objects ( ** filters ) #NEWLINE# if exist . count ( ) : #NEWLINE# #INDENT# if current_app . config . get ( 'SMART_SLUG_ENABLED' , False ) : #NEWLINE# #INDENT# self . slug = '{0}-{1}' . format ( self . slug , random . getrandbits ( 32 ) ) #NEWLINE# self . _create_mpath_long_slug ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise db . ValidationError ( lazy_gettext ( '%(slug)s slug already exists' , slug = self . long_slug ) )