Class Reference

Decorators

django_webix.utils.decorators.script_login_required(view, login_url=None)[source]

Template Tags

django_webix.templatetags.django_webix_utils.do_if_has_tag(parser, token, negate=False)[source]

The logic for both {% if_has_tag %} and {% if not_has_tag %}. Checks if all the given tags exist (or not exist if negate is True) and then only parses the branch that will not error due to non-existing tags. This means that the following is essentially the same as a {% comment %} tag:

{% if_has_tag non_existing_tag %}
    {% non_existing_tag %}
{% endif_has_tag %}

Another example is checking a built-in tag. This will always render the current year and never FAIL:

{% if_has_tag now %}
    {% now "Y" %}
{% else %}
    FAIL
{% endif_has_tag %}
django_webix.templatetags.django_webix_utils.friendly_load(parser, token)[source]

Tries to load a custom template tag set. Non existing tag libraries are ignored. This means that, if used in conjunction with if_has_tag, you can try to load the comments template tag library to enable comments even if the comments framework is not installed. For example:

{% load friendly_loader %}
{% friendly_load comments webdesign %}
{% if_has_tag render_comment_list %}
    {% render_comment_list for obj %}
{% else %}
    {% if_has_tag lorem %}
        {% lorem %}
    {% endif_has_tag %}
{% endif_has_tag %}
django_webix.templatetags.django_webix_utils.get_value_from_dict(dict_data, key)[source]

usage example {{ your_dict|get_value_from_dict:your_key }}

django_webix.templatetags.django_webix_utils.getattr(obj, args)[source]

Try to get an attribute from an object.

Example: {% if block|getattr:”editable,True” %}

Beware that the default is always a string, if you want this to return False, pass an empty second argument: {% if block|getattr:”editable,” %}

django_webix.templatetags.django_webix_utils.if_has_tag(parser, token)[source]
Do something if all given tags are loaded::

{% load friendly_loader %} {% friendly_load webdesign %} {% if_has_tag lorem %}

{% lorem %}
{% else %}
Non dummy content goes here!

{% endif_has_tag %}

When given multiple arguments each and every tag in the list has to be available. This means that the following will render nothing:

{% if_has_tag now nonexisting_tag %}
    {% now "Y" %}
{% endif_has_tag %}
django_webix.templatetags.django_webix_utils.ifnot_has_tag(parser, token)[source]
Do something unless any given tag is loaded::

{% load friendly_loader %} {% friendly_load comments %} {% ifnot_has_tag render_comment_list %}

Comment support has been disabled.
{% else %}
{% render_comment_list for obj %}

{% endifnot_has_tag %}

In the case of multiple arguments, the condition will trigger if any tag in the list is unavailable. This means that the following will still render the current year:

{% ifnot_has_tag now nonexisting_tag %}
    {% now "Y" %}
{% endifnot_has_tag %}

Forms

Forms Mixin

Formsets

Views

View Mixins

class django_webix.views.generic.base.WebixPermissionsMixin[source]
class django_webix.views.generic.base.WebixUrlMixin[source]
class django_webix.views.generic.base.WebixBaseMixin[source]

Utils

Admin Config

class django_webix.admin_webix.apps.SimpleAdminWebixConfig(app_name, app_module)[source]

Simple AppConfig which does not do automatic discovery.

ready()[source]

Override this method in subclasses to run code when Django starts.

class django_webix.admin_webix.apps.AdminWebixConfig(app_name, app_module)[source]

The default AppConfig for admin which does autodiscovery.

ready()[source]

Override this method in subclasses to run code when Django starts.

Admin Decorators

django_webix.admin_webix.decorators.register(*models, site=None)[source]

Register the given model(s) classes and wrapped ModelWebixAdmin class with admin site: @register(Author) class AuthorAdmin(admin.ModelAdmin):

pass

The site kwarg is an admin site to use instead of the default admin site.

Parameters:
  • models
  • site
Returns:

Admin Options

class django_webix.admin_webix.options.ModelWebixAdmin(model, admin_site)[source]
get_model_perms(request)[source]

Return a dict of all perms for this model. This dict has the keys add, change, delete, and view mapping to the True/False for each of those actions.

Admin Sites

class django_webix.admin_webix.sites.AlreadyRegistered[source]
class django_webix.admin_webix.sites.NotRegistered[source]
class django_webix.admin_webix.sites.AdminWebixSite(name='admin_webix')[source]
admin_view(view, cacheable=False)[source]

Decorator to create an admin view attached to this AdminWebixSite. This wraps the view and provides permission checking by calling self.has_permission. You’ll want to use this from within AdminWebixSite.get_urls():

class MyAdminWebixSite(AdminWebixSite):
def get_urls(self):

from django.urls import path urls = super().get_urls() urls += [

path(‘my_view/’, self.admin_view(some_view))

] return urls

By default, admin_views are marked non-cacheable using the never_cache decorator. If the view can be safely cached, set cacheable=True.

each_context(request)[source]

Return a dictionary of variables to put in the template context for every page in the admin site. For sites running on a subpath, use the SCRIPT_NAME value if site_url hasn’t been customized.

get_app_list(request)[source]

Return a sorted list of all the installed apps that have been registered in this site.

has_permission(request)[source]

Return True if the given HttpRequest has permission to view at least one page in the admin site.

index(request, extra_context=None)[source]

Display the main admin index page, which lists all of the installed apps that have been registered in this site.

is_registered(model)[source]

Check if a model class is registered with this AdminWebixSite.

login(request, extra_context=None)[source]

Display the login form for the given HttpRequest.

logout(request, extra_context=None)[source]

Log out the user for the given HttpRequest. This should not assume the user is already logged in.

password_change(request, extra_context=None)[source]

Handle the “change password” task – both form display and validation.

password_change_done(request, extra_context=None)[source]

Display the “success” page after a password change.

password_reset(request, extra_context=None)[source]

Handle the “reset password” task – both form display and validation.

password_reset_done(request, extra_context=None)[source]

Handle the “reset password” task – both form display and validation.

register(model_or_iterable, admin_class=None, **options)[source]

Register the given model(s) with the given admin class. The model(s) should be Model classes, not instances. If an admin class isn’t given, use ModelWebixAdmin (the default admin options). If keyword arguments are given – e.g., list_display – apply them as options to the admin class. If a model is already registered, raise AlreadyRegistered. If a model is abstract, raise ImproperlyConfigured.

unregister(model_or_iterable)[source]

Unregister the given model(s). If a model isn’t already registered, raise NotRegistered.

class django_webix.admin_webix.sites.DefaultAdminWebixSite[source]