Ticket #12340: generic_inline_order_qs_v1.diff
File generic_inline_order_qs_v1.diff, 882 bytes (added by , 15 years ago) |
---|
-
django/contrib/contenttypes/generic.py
317 317 from django.contrib.contenttypes.models import ContentType 318 318 if self.instance is None or self.instance.pk is None: 319 319 return self.model._default_manager.none() 320 returnself.model._default_manager.filter(**{320 qs = self.model._default_manager.filter(**{ 321 321 self.ct_field.name: ContentType.objects.get_for_model(self.instance), 322 322 self.ct_fk_field.name: self.instance.pk, 323 323 }) 324 if not qs.ordered: 325 qs = qs.order_by(self.model._meta.pk.name) 326 return qs 324 327 325 328 def save_new(self, form, commit=True): 326 329 # Avoid a circular import.