mirror of https://github.com/django/django.git
Simplified dict initialization in two places.
This commit is contained in:
parent
7a48f9abf2
commit
917100eed7
|
@ -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):
|
||||
|
|
|
@ -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()}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue