From 917100eed7ba2f0aca2c1a5b64821c8ba5cc1bcc Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Sat, 7 Nov 2015 11:46:22 +0100 Subject: [PATCH] Simplified dict initialization in two places. --- django/db/models/expressions.py | 6 ++++-- django/template/context_processors.py | 13 +++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 1497681d57..b98095739c 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -982,8 +982,10 @@ class OrderBy(BaseExpression): def as_sql(self, compiler, connection): connection.ops.check_expression_support(self) expression_sql, params = compiler.compile(self.expression) - placeholders = {'expression': expression_sql} - placeholders['ordering'] = 'DESC' if self.descending else 'ASC' + placeholders = { + 'expression': expression_sql, + 'ordering': 'DESC' if self.descending else 'ASC', + } return (self.template % placeholders).rstrip(), params def get_group_by_cols(self): diff --git a/django/template/context_processors.py b/django/template/context_processors.py index c356b4cee5..d46cd3ec8f 100644 --- a/django/template/context_processors.py +++ b/django/template/context_processors.py @@ -49,18 +49,15 @@ def debug(request): def i18n(request): from django.utils import translation - - context_extras = {} - context_extras['LANGUAGES'] = settings.LANGUAGES - context_extras['LANGUAGE_CODE'] = translation.get_language() - context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi() - - return context_extras + return { + 'LANGUAGES': settings.LANGUAGES, + 'LANGUAGE_CODE': translation.get_language(), + 'LANGUAGE_BIDI': translation.get_language_bidi(), + } def tz(request): from django.utils import timezone - return {'TIME_ZONE': timezone.get_current_timezone_name()}