def test_invalid_value(self): widget = NullableForeignKeyWidget(Partner, "name") self.assertEqual(widget.clean("unknown partner"), None)
def test_valid_value(self): widget = NullableForeignKeyWidget(Partner, "name") self.assertEqual(widget.clean("test partner").id, self.record.id)