#NEWLINE# def update_display_field( apps , schema_editor ) : #NEWLINE# #INDENT# Category = apps . get_model ( 'categories' , 'Category' ) #NEWLINE# Field = apps . get_model ( 'categories' , 'Field' ) #NEWLINE# for category in Category . objects . all ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# first_field = category . fields . get ( order = 0 ) #NEWLINE# category . display_field = first_field #NEWLINE# category . save ( ) #NEWLINE# #UNINDENT# except Field . DoesNotExist : #NEWLINE# #INDENT# pass