utils.safestring.mark_safe()

mark_safe(s) [source] Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string or unicode object is appropriate. Can be called multiple times on a single string. For building up fragments of HTML, you should normally be using django.utils.html.format_html() instead. String marked safe will become unsafe again if modified. For example: >>> mystr = '<b>Hello World</b> ' >>> mystr = mark_safe(mystr) >>

utils.safestring.SafeBytes

class SafeBytes [source] A bytes subclass that has been specifically marked as “safe” (requires no further escaping) for HTML output purposes.

utils.safestring.SafeString

class SafeString A str subclass that has been specifically marked as “safe” (requires no further escaping) for HTML output purposes. This is SafeBytes on Python 2 and SafeText on Python 3.

utils.safestring.SafeText

class SafeText [source] A str (in Python 3) or unicode (in Python 2) subclass that has been specifically marked as “safe” for HTML output purposes.

utils.safestring.SafeUnicode

class SafeUnicode Historical name of SafeText. Only available under Python 2.

utils.text.slugify()

slugify(allow_unicode=False) [source] Converts to ASCII if allow_unicode is False (default). Converts spaces to hyphens. Removes characters that aren’t alphanumerics, underscores, or hyphens. Converts to lowercase. Also strips leading and trailing whitespace. For example: slugify(value) If value is "Joel is a slug", the output will be "joel-is-a-slug". You can set the allow_unicode parameter to True, if you want to allow Unicode characters: slugify(value, allow_unicode=True) If value is "你

utils.timezone.activate()

activate(timezone) [source] Sets the current time zone. The timezone argument must be an instance of a tzinfo subclass or, if pytz is available, a time zone name.

utils.timezone.deactivate()

deactivate() [source] Unsets the current time zone.

utils.timezone.FixedOffset

class FixedOffset(offset=None, name=None) [source] A tzinfo subclass modeling a fixed offset from UTC. offset is an integer number of minutes east of UTC.

utils.timezone.get_current_timezone()

get_current_timezone() [source] Returns a tzinfo instance that represents the current time zone.