Ticket #1372: related.py.patch

File related.py.patch, 1.0 KB (added by matt, 9 years ago)
  • Users/mcroydon/django/django_magic/django/db/models/fields/related.py

     
    470470
    471471    def isValidIDList(self, field_data, all_data):
    472472        "Validates that the value is a valid list of foreign keys"
    473         mod = self.rel.to._meta.get_model_module()
     473        mod = self.rel.to
    474474        try:
    475475            pks = map(int, field_data.split(','))
    476476        except ValueError:
    477477            # the CommaSeparatedIntegerField validator will catch this error
    478478            return
    479         objects = mod.get_in_bulk(pks)
     479        objects = mod.objects.in_bulk(pks)
    480480        if len(objects) != len(pks):
    481481            badkeys = [k for k in pks if k not in objects]
    482482            raise validators.ValidationError, ngettext("Please enter valid %(self)s IDs. The value %(value)r is invalid.",
Back to Top