'Test add and edit form related fields filter'

def test_query_rel_fields(self):

    client = self.app.test_client()
    rv = self.login(client, DEFAULT_ADMIN_USER, DEFAULT_ADMIN_PASSWORD)
    self.insert_data2()
    rv = client.get('/model2view/add')
    data = rv.data.decode('utf-8')
    ok_(('G1' in data))
    ok_(('G2' not in data))
    model2 = Model2.objects[0]
    rv = client.get('/model2view/edit/{0}'.format(model2.id))
    data = rv.data.decode('utf-8')
    ok_(('G2' in data))
    ok_(('G1' not in data))
    self.clean_data()
