#NEWLINE# def handle_fk_field( self , obj , field ) : #NEWLINE# #INDENT# '\n        Called to handle a ForeignKey (we need to treat them slightly\n        differently from regular fields).\n        ' #NEWLINE# self . _start_relational_field ( field ) #NEWLINE# related = getattr ( obj , field . name ) #NEWLINE# if ( related is not None ) : #NEWLINE# #INDENT# if ( self . use_natural_keys and hasattr ( related , 'natural_key' ) ) : #NEWLINE# #INDENT# related = related . natural_key ( ) #NEWLINE# for key_value in related : #NEWLINE# #INDENT# self . xml . startElement ( 'natural' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . xml . characters ( smart_unicode ( obj ) ) #NEWLINE# self . xml . endElement ( 'natural' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( field . rel . field_name == related . _meta . pk . name ) : #NEWLINE# #INDENT# related = related . _get_pk_val ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# related = getattr ( related , field . rel . field_name ) #NEWLINE# #UNINDENT# self . xml . characters ( smart_unicode ( related ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . xml . addQuickElement ( 'None' ) #NEWLINE# #UNINDENT# self . xml . endElement ( 'field' )