[2.2.x] Fixed ForeignKeyRawIdWidgetTest.test_render_unsafe_limit_choices_to on Python 3.5.

This commit is contained in:
Mariusz Felisiak 2020-07-02 10:59:15 +02:00 committed by GitHub
parent 202ac0b2a1
commit 5968a23e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -590,11 +590,14 @@ class ForeignKeyRawIdWidgetTest(TestCase):
def test_render_unsafe_limit_choices_to(self):
rel = UnsafeLimitChoicesTo._meta.get_field('band').remote_field
w = widgets.ForeignKeyRawIdWidget(rel, widget_admin_site)
parameters = w.url_parameters()
parameters['name'] = '%22%26%3E%3Cescapeme'
self.assertHTMLEqual(
w.render('test', None),
'<input type="text" name="test" class="vForeignKeyRawIdAdminField">'
'<a href="/admin_widgets/band/?name=%22%26%3E%3Cescapeme&amp;_to_field=id" '
'class="related-lookup" id="lookup_id_test" title="Lookup"></a>'
'<a class="related-lookup" href="/admin_widgets/band/?%s" '
'id="lookup_id_test" title="Lookup"></a>'
% '&amp;'.join('%s=%s' % (k, v) for k, v in parameters.items())
)