Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #14257 -- removed ManyToManyField.isValidIDList which was compl…
…etely dead code (unused since magic-removal). Thanks to andrewsk for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Nov 17, 2010
1 parent 0eb31d3 commit fc47f8c
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions django/db/models/fields/related.py
Expand Up @@ -1056,25 +1056,6 @@ def _get_m2m_reverse_attr(self, related, attr):
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:
Expand Down

0 comments on commit fc47f8c

Please sign in to comment.