mirror of
https://github.com/django/django.git
synced 2025-10-05 00:00:37 +00:00
Fixed select_related performance regressions
The regression was caused by select_related fix for Oracle, commit
c159d9cec0
.
This commit is contained in:
parent
ce1af8d702
commit
ebcf6b36ff
2 changed files with 18 additions and 20 deletions
|
@ -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()
|
||||
|
@ -175,6 +174,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue