Simplified dict initialization in two places.

This commit is contained in:
Dmitry Dygalo 2015-11-07 11:46:22 +01:00 committed by Tim Graham
parent 7a48f9abf2
commit 917100eed7
2 changed files with 9 additions and 10 deletions

View File

@ -982,8 +982,10 @@ class OrderBy(BaseExpression):
def as_sql(self, compiler, connection): def as_sql(self, compiler, connection):
connection.ops.check_expression_support(self) connection.ops.check_expression_support(self)
expression_sql, params = compiler.compile(self.expression) expression_sql, params = compiler.compile(self.expression)
placeholders = {'expression': expression_sql} placeholders = {
placeholders['ordering'] = 'DESC' if self.descending else 'ASC' 'expression': expression_sql,
'ordering': 'DESC' if self.descending else 'ASC',
}
return (self.template % placeholders).rstrip(), params return (self.template % placeholders).rstrip(), params
def get_group_by_cols(self): def get_group_by_cols(self):

View File

@ -49,18 +49,15 @@ def debug(request):
def i18n(request): def i18n(request):
from django.utils import translation from django.utils import translation
return {
context_extras = {} 'LANGUAGES': settings.LANGUAGES,
context_extras['LANGUAGES'] = settings.LANGUAGES 'LANGUAGE_CODE': translation.get_language(),
context_extras['LANGUAGE_CODE'] = translation.get_language() 'LANGUAGE_BIDI': translation.get_language_bidi(),
context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi() }
return context_extras
def tz(request): def tz(request):
from django.utils import timezone from django.utils import timezone
return {'TIME_ZONE': timezone.get_current_timezone_name()} return {'TIME_ZONE': timezone.get_current_timezone_name()}