mirror of
https://github.com/django/django.git
synced 2025-07-06 02:39:12 +00:00
queryset-refactor: Fixed some Python 2.3 problems.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bef4ca2bac
commit
648a3d87a3
@ -109,7 +109,7 @@ class FormPreview(object):
|
||||
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
|
||||
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
|
||||
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
|
||||
pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
|
||||
pickled = pickle.dumps(data, pickle.HIGHEST_PROTOCOL)
|
||||
return md5.new(pickled).hexdigest()
|
||||
|
||||
def failed_hash(self, request):
|
||||
|
@ -173,11 +173,12 @@ class Options(object):
|
||||
Initialises the field name -> field object mapping.
|
||||
"""
|
||||
cache = dict([(f.name, (f, True, False)) for f in self.fields])
|
||||
cache.update([(f.name, (f, True, True)) for f in self.many_to_many])
|
||||
cache.update([(f.field.related_query_name(), (f, False, True))
|
||||
for f in self.get_all_related_many_to_many_objects()])
|
||||
cache.update([(f.field.related_query_name(), (f, False, False))
|
||||
for f in self.get_all_related_objects()])
|
||||
for f in self.many_to_many:
|
||||
cache[f.name] = (f, True, True)
|
||||
for f in self.get_all_related_many_to_many_objects():
|
||||
cache[f.field.related_query_name()] = (f, False, True)
|
||||
for f in self.get_all_related_objects():
|
||||
cache[f.field.related_query_name()] = (f, False, False)
|
||||
if app_cache_ready():
|
||||
self._name_map = cache
|
||||
return cache
|
||||
|
@ -395,7 +395,8 @@ class ValuesQuerySet(QuerySet):
|
||||
if self._fields:
|
||||
opts = self.model._meta
|
||||
all = dict([(field.column, field) for field in opts.fields])
|
||||
all.update([(field.name, field) for field in opts.fields])
|
||||
for field in opts.fields:
|
||||
all[field.name] = field
|
||||
if not self.query.extra_select:
|
||||
try:
|
||||
fields = [all[f] for f in self._fields]
|
||||
|
Loading…
x
Reference in New Issue
Block a user