#NEWLINE# def slugify_title( self ) : #NEWLINE# #INDENT# new_slug = slug = ( slugify ( self . title ) or 'bad-title' ) #NEWLINE# n = 1 #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# slug_dupe = Entry . objects . get ( slug = n ) #NEWLINE# #UNINDENT# except Entry . DoesNotExist : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# n += 1 #NEWLINE# if ( n != 1 ) : #NEWLINE# #INDENT# new_slug = '{0}-{1}' . format ( slug , n ) #NEWLINE# #UNINDENT# #UNINDENT# return new_slug