Django

Django app config

Django app config for the Translucent app.

class confirm.translucent.django.apps.TranslucentConfig(app_name, app_module)

Translucent’s Django app config which makes Translucent’s static files and form templates available the the Django project.

Hint

To use the confirm.translucent Python module as Django app, simply configure your Django project to use this config by adding the following entry to the INSTALLED_APPS list:

INSTALLED_APPS = [
    # existing apps…
    'confirm.translucent.django.TranslucentConfig',
]

Django forms

Translucent’s Django Forms.

class confirm.translucent.django.forms.TranslucentForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)

A Django Form which renders Translucent-compatible markup.

property media

Return all media required to render the widgets on this form.

class confirm.translucent.django.forms.TranslucentLoginForm(request=None, *args, **kwargs)

A Django ModelForm which renders Translucent-compatible markup.

property media

Return all media required to render the widgets on this form.

class confirm.translucent.django.forms.TranslucentModelForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)

A Django ModelForm which renders Translucent-compatible markup.

property media

Return all media required to render the widgets on this form.

Django context processors

Site template context processors.

confirm.translucent.django.template.context_processors.translucent(request)

Retreives the values required for translucent and adds them to the template context.

Parameters:

request (django.http.HttpRequest) – The HTTP request

Returns:

The translucent template context

Return type:

dict

Django template tags

Translucent’s template tags.

confirm.translucent.django.templatetags.translucent.translucent_csrf_token(*args)

A Translucent-compatible CSRF token.

Parameters:

*args (list) – The arguments

Returns:

The CSRF token node

Return type:

CsrfTokenNode

Hint

To use the template tag in your template, you’ve to load the translucent library, then define the template filter in a form:

{% load translucent %}

<c-form>
    {% translucent_csrf_token %}
    …
</c-form>
confirm.translucent.django.templatetags.translucent.translucent_data(queryset, fields=None)

Converts a Django queryset to a Translucent data / JSON object.

Parameters:
Returns:

The JSON object

Return type:

str

Hint

To use the template filter in your template, you’ve to load the translucent library, then pass a queryset to the template filter:

{% load translucent %}

<c-select data-data="{{ queryset | translucent_data }}"></c-select>