mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed select_related performance regressions
The regression was caused by select_related fix for Oracle, commit
c159d9cec0.
This commit is contained in:
@@ -9,11 +9,10 @@ from django.db.models.fields.related import ManyToManyRel
|
||||
from django.db.models.fields import AutoField, FieldDoesNotExist
|
||||
from django.db.models.fields.proxy import OrderWrt
|
||||
from django.db.models.loading import get_models, app_cache_ready
|
||||
from django.utils.translation import activate, deactivate_all, get_language, string_concat
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils import six
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.encoding import force_text, smart_text, python_2_unicode_compatible
|
||||
from django.utils.translation import activate, deactivate_all, get_language, string_concat
|
||||
|
||||
# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
|
||||
get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip()
|
||||
@@ -194,6 +193,10 @@ class Options(object):
|
||||
self.pk = field
|
||||
field.serialize = False
|
||||
|
||||
def pk_index(self):
|
||||
return [pos for pos, field in enumerate(self.fields)
|
||||
if field == self.pk][0]
|
||||
|
||||
def setup_proxy(self, target):
|
||||
"""
|
||||
Does the internal setup so that the current model is a proxy for
|
||||
|
||||
Reference in New Issue
Block a user