summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Dygalo <d.dygalo@volsor.com>2015-11-07 11:46:22 +0100
committerTim Graham <timograham@gmail.com>2015-11-07 21:46:46 +0100
commit917100eed7ba2f0aca2c1a5b64821c8ba5cc1bcc (patch)
tree4aa0131b796d0133ce32aec1a7f153839fb99b10
parent7a48f9abf276d9d5d757f74d405c9c1d7642b7a0 (diff)
Simplified dict initialization in two places.
-rw-r--r--django/db/models/expressions.py6
-rw-r--r--django/template/context_processors.py13
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()}