Author: Alex
Date: 2010-11-17 11:00:40 -0600 (Wed, 17 Nov 2010)
New Revision: 14602
Modified:
django/trunk/django/db/models/fields/related.py
Log:
Fixed #14257 -- removed ManyToManyField.isValidIDList which was completely dead
code (unused since magic-removal). Thanks to andrewsk for the patch.
Modified: django/trunk/django/db/models/fields/related.py
===================================================================
--- django/trunk/django/db/models/fields/related.py 2010-11-17 16:47:46 UTC
(rev 14601)
+++ django/trunk/django/db/models/fields/related.py 2010-11-17 17:00:40 UTC
(rev 14602)
@@ -1056,25 +1056,6 @@
break
return getattr(self, cache_attr)
- def isValidIDList(self, field_data, all_data):
- "Validates that the value is a valid list of foreign keys"
- mod = self.rel.to
- try:
- pks = map(int, field_data.split(','))
- except ValueError:
- # the CommaSeparatedIntegerField validator will catch this error
- return
- objects = mod._default_manager.in_bulk(pks)
- if len(objects) != len(pks):
- badkeys = [k for k in pks if k not in objects]
- raise exceptions.ValidationError(
- ungettext("Please enter valid %(self)s IDs. The value
%(value)r is invalid.",
- "Please enter valid %(self)s IDs. The values
%(value)r are invalid.",
- len(badkeys)) % {
- 'self': self.verbose_name,
- 'value': len(badkeys) == 1 and badkeys[0] or tuple(badkeys),
- })
-
def value_to_string(self, obj):
data = ''
if obj:
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.