#NEWLINE# def test_foreign_object_form( self ) : #NEWLINE# #INDENT# form = FormsTests . ArticleForm ( ) #NEWLINE# self . assertIn ( 'id_pub_date' , form . as_table ( ) ) #NEWLINE# self . assertNotIn ( 'active_translation' , form . as_table ( ) ) #NEWLINE# form = FormsTests . ArticleForm ( data = { #NEWLINE# #INDENT# 'pub_date' : str ( datetime . date . today ( ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( form . is_valid ( ) ) #NEWLINE# a = form . save ( ) #NEWLINE# self . assertEqual ( form . pub_date , datetime . date . today ( ) ) #NEWLINE# form = FormsTests . ArticleForm ( instance = a , data = { #NEWLINE# #INDENT# 'pub_date' : '2013-01-01' , #NEWLINE# #UNINDENT# } ) #NEWLINE# a2 = form . save ( ) #NEWLINE# self . assertEqual ( a . pk , a2 . pk ) #NEWLINE# self . assertEqual ( a2 . pub_date , datetime . date ( 2013 , 1 , 1 ) )