Ticket #6045: related.py.diff
File related.py.diff, 1.1 KB (added by , 17 years ago) |
---|
-
db/models/fields/related.py
5 5 from django.utils.text import capfirst 6 6 from django.utils.translation import ugettext_lazy, string_concat, ungettext, ugettext as _ 7 7 from django.utils.functional import curry 8 from django.utils.encoding import smart_unicode 8 from django.utils.encoding import smart_unicode, smart_str 9 9 from django.core import validators 10 10 from django import oldforms 11 11 from django import newforms as forms … … 281 281 raise ValueError("%r instance needs to have a primary key value before a many-to-many relationship can be used." % model) 282 282 283 283 def get_query_set(self): 284 for key, value in self.core_filters.items(): 285 if not isinstance(key, str): 286 del self.core_filters[key] 287 self.core_filters[smart_str(key)] = smart_str(value) 284 288 return superclass.get_query_set(self).filter(**(self.core_filters)) 285 289 286 290 def add(self, *objs):