misc: don't crash on missing language code (#21252)

This happens with the "check" management command.
This commit is contained in:
Frédéric Péters 2019-02-20 11:05:10 +01:00
parent eb070bfc8d
commit 61193bc82d
1 changed files with 2 additions and 1 deletions

View File

@ -70,7 +70,8 @@ class PickerWidgetMixin(object):
attrs = {'readonly': ''}
self.options = options
self.options['language'] = get_language().split('-')[0]
if get_language():
self.options['language'] = get_language().split('-')[0]
# We're not doing localisation, get the Javascript date format provided by the user,
# with a default, and convert it to a Python data format for later string parsing