#NEWLINE# def get_default( self ) : #NEWLINE# #INDENT# 'Here we check if the default value is an object and return the to_field if so.' #NEWLINE# field_default = super ( ForeignKey , self ) . get_default ( ) #NEWLINE# if isinstance ( field_default , self . remote_field . model ) : #NEWLINE# #INDENT# return getattr ( field_default , self . target_field . attname ) #NEWLINE# #UNINDENT# return field_default