Ticket #6045: patch.diff

File patch.diff, 1.3 KB (added by Gonzalo Saavedra, 12 years ago)
  • db/models/fields/related.py

     
    44from django.db.models.related import RelatedObject
    55from django.db.models.query import QuerySet
    66from django.db.models.query_utils import QueryWrapper
    7 from django.utils.encoding import smart_unicode
     7from django.utils.encoding import smart_unicode, smart_str
    88from django.utils.translation import ugettext_lazy, string_concat, ungettext, ugettext as _
    99from django.utils.functional import curry
    1010from django.core import exceptions
     
    362362        def __init__(self, model=None, core_filters=None, instance=None, symmetrical=None,
    363363                join_table=None, source_col_name=None, target_col_name=None):
    364364            super(ManyRelatedManager, self).__init__()
    365             self.core_filters = core_filters
     365            self.core_filters = {}
     366            if core_filters:
     367                for key, value in core_filters.items():
     368                    if not isinstance(key, str):
     369                        key = smart_str(key)
     370                    self.core_filters[key] = value
    366371            self.model = model
    367372            self.symmetrical = symmetrical
    368373            self.instance = instance
Back to Top