utils.translation.deactivate()

deactivate() [source] Deactivates the currently active translation object so that further _ calls will resolve against the default translation object, again.

utils.translation.check_for_language()

check_for_language(lang_code) [source] Checks whether there is a global language file for the given language code (e.g. ‘fr’, ‘pt_BR’). This is used to decide whether a user-provided language is available.

utils.translation.activate()

activate(language) [source] Fetches the translation object for a given language and activates it as the current translation object for the current thread.

utils.timezone.override()

override(timezone) [source] This is a Python context manager that sets the current time zone on entry with activate(), and restores the previously active time zone on exit. If the timezone argument is None, the current time zone is unset on entry with deactivate() instead. override is also usable as a function decorator.

utils.timezone.now()

now() [source] Returns a datetime that represents the current point in time. Exactly what’s returned depends on the value of USE_TZ: If USE_TZ is False, this will be a naive datetime (i.e. a datetime without an associated timezone) that represents the current time in the system’s local timezone. If USE_TZ is True, this will be an aware datetime representing the current time in UTC. Note that now() will always return times in UTC regardless of the value of TIME_ZONE; you can use localtime() t

utils.timezone.make_naive()

make_naive(value, timezone=None) [source] Returns an naive datetime that represents in timezone the same point in time as value, value being an aware datetime. If timezone is set to None, it defaults to the current time zone.

utils.timezone.make_aware()

make_aware(value, timezone=None, is_dst=None) [source] Returns an aware datetime that represents the same point in time as value in timezone, value being a naive datetime. If timezone is set to None, it defaults to the current time zone. When pytz is installed, the exception pytz.AmbiguousTimeError will be raised if you try to make value aware during a DST transition where the same time occurs twice (when reverting from DST). Setting is_dst to True or False will avoid the exception by choosi

utils.timezone.localtime()

localtime(value, timezone=None) [source] Converts an aware datetime to a different time zone, by default the current time zone. This function doesn’t work on naive datetimes; use make_aware() instead.

utils.timezone.is_naive()

is_naive(value) [source] Returns True if value is naive, False if it is aware. This function assumes that value is a datetime.

utils.timezone.is_aware()

is_aware(value) [source] Returns True if value is aware, False if it is naive. This function assumes that value is a datetime.