Ticket #10015: 10015_r9729.diff
File 10015_r9729.diff, 902 bytes (added by , 16 years ago) |
---|
-
django/contrib/contenttypes/generic.py
310 310 return self.model._default_manager.empty() 311 311 return self.model._default_manager.filter(**{ 312 312 self.ct_field.name: ContentType.objects.get_for_model(self.instance), 313 self.ct_fk_field.name: self. instance.pk,313 self.ct_fk_field.name: self._cast_instance_pk(self.instance.pk), 314 314 }) 315 315 316 def _cast_instance_pk(self, pk): 317 if self.ct_fk_field.get_internal_type() == 'TextField': 318 return smart_unicode(pk) 319 return pk 320 316 321 def save_new(self, form, commit=True): 317 322 # Avoid a circular import. 318 323 from django.contrib.contenttypes.models import ContentType