Ticket #6045: related.py.patch

File related.py.patch, 1.2 KB (added by Rémy Hubscher, 10 years ago)

New patch for Django 1.2.3

  • django/db/models/fields/related.py

    old new  
    77from django.db.models.related import RelatedObject
    88from django.db.models.query import QuerySet
    99from django.db.models.query_utils import QueryWrapper
    10 from django.utils.encoding import smart_unicode
     10from django.utils.encoding import smart_unicode, smart_str
    1111from django.utils.translation import ugettext_lazy as _, string_concat, ungettext, ugettext
    1212from django.utils.functional import curry
    1313from django.core import exceptions
     
    467467                join_table=None, source_field_name=None, target_field_name=None,
    468468                reverse=False):
    469469            super(ManyRelatedManager, self).__init__()
    470             self.core_filters = core_filters
     470
     471            self.core_filters = {}
     472            if core_filters:
     473                for key, value in core_filters.items():
     474                    if not isinstance(key, str):
     475                        key = smart_str(key)
     476                    self.core_filters[key] = value
     477
    471478            self.model = model
    472479            self.symmetrical = symmetrical
    473480            self.instance = instance
Back to Top