autodonate.lib.templatetags.statictags#

Modified version of standard Django static templatetag.

The link for static is generated as usual, but the ver argument is added to the end with the value settings.RUN_ID.

Module Contents#

Classes#

StaticNode

Modified StaticNode, that adds RUN_ID to URI.

Functions#

do_static(parser: django.template.base.Parser, token: django.template.base.Token) → django.template.Node

Join the given path with the STATIC_URL setting. For internal Django usage.

get_static_prefix(parser: django.template.base.Parser, token: django.template.base.Token) → django.template.Node

Return STATIC_URL.

get_media_prefix(parser: django.template.base.Parser, token: django.template.base.Token) → django.template.Node

Return MEDIA_URL.

static(path: str) → str

Given a relative path to a static asset, return the absolute path to the asset.

Attributes#

register[source]#
class StaticNode(varname=None, path=None)[source]#

Bases: django.templatetags.static.StaticNode

Modified StaticNode, that adds RUN_ID to URI.

pre_render(self, context: django.template.Context) str[source]#

Join STATIC_URL with path.

render(self, context: django.template.Context)[source]#

Join STATIC_URL with path and add ver argument.

For internal Django usage.

static process_url(url: str) str[source]#

Add ver arg to given url.

Parameters

url – URI

Returns

joined url with ?ver=RUN_ID

Example: https://some.domain/static/path/to/asset.css?ver=543564

do_static(parser: django.template.base.Parser, token: django.template.base.Token) django.template.Node[source]#

Join the given path with the STATIC_URL setting. For internal Django usage.

get_static_prefix(parser: django.template.base.Parser, token: django.template.base.Token) django.template.Node[source]#

Return STATIC_URL.

get_media_prefix(parser: django.template.base.Parser, token: django.template.base.Token) django.template.Node[source]#

Return MEDIA_URL.

static(path: str) str[source]#

Given a relative path to a static asset, return the absolute path to the asset.

Parameters

path – relative path to asset

Returns

joined path and STATIC_URL

Example: /static/path/to/asset.css?ver=543564