1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[1.2.X] Fixed #13149 -- The admin ForeignKeyRawIdWidget now properly handles non-integer values. Thanks, Chris Adams.

Backport of r13751 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn
2010-09-11 18:38:24 +00:00
parent f4ebd701f2
commit e4bd5e8a2d
3 changed files with 16 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
# encoding: utf-8
from django import forms
from django.contrib import admin
from django.contrib.admin import widgets
@@ -151,3 +153,13 @@ class AdminForeignKeyRawIdWidget(DjangoTestCase):
post_data)
self.assertContains(response,
'Select a valid choice. That choice is not one of the available choices.')
def test_invalid_target_id(self):
for test_str in ('Iñtërnâtiônàlizætiøn', "1234'", -1234):
# This should result in an error message, not a server exception.
response = self.client.post('%s/admin_widgets/event/add/' % self.admin_root,
{"band": test_str})
self.assertContains(response,
'Select a valid choice. That choice is not one of the available choices.')