basxbread package

Subpackages

Submodules

basxbread.dynamic_preferences_registry module

Bases: FilePreference

default = ''

A default value for the preference

field_class

alias of ImageField

field_kwargs = {'required': False}

Additional kwargs to be passed to the form field.

Example:

class MyPreference(StringPreference):

    field_kwargs = {
        'required': False,
        'initial': 'Hello there'
    }
name = 'logo'

The preference name

section = <dynamic_preferences.preferences.Section object>

The section under which the preference will be registered

verbose_name = 'Logo'
class basxbread.dynamic_preferences_registry.OrganizationName(registry=None)

Bases: StringPreference

default = '<Organization Name>'

A default value for the preference

name = 'organizationname'

The preference name

section = <dynamic_preferences.preferences.Section object>

The section under which the preference will be registered

verbose_name = 'Organization Name'
class basxbread.dynamic_preferences_registry.PreferredLanguage(registry=None)

Bases: StringPreference

default = ''

A default value for the preference

name = 'preferred_language'

The preference name

section = <dynamic_preferences.preferences.Section object>

The section under which the preference will be registered

verbose_name = 'Preferred Language'
class basxbread.dynamic_preferences_registry.Timezone(registry=None)

Bases: StringPreference

default = ''

A default value for the preference

name = 'timezone'

The preference name

section = <dynamic_preferences.preferences.Section object>

The section under which the preference will be registered

verbose_name = 'Timezone'

basxbread.formatters module

basxbread.formatters.as_countries(value)
basxbread.formatters.as_download(value, label=None)
basxbread.formatters.as_duration(value)
basxbread.formatters.as_email(value)
basxbread.formatters.as_list(iterable)
basxbread.formatters.as_text(value)
basxbread.formatters.as_url(value)
basxbread.formatters.format_value(value)

Renders a python value in a nice way in HTML. If a field-definition has an attribute “renderer” set, that function will be used to render the value

basxbread.formatters.is_email_simple(value)

Return True if value looks like an email address.

basxbread.menu module

class basxbread.menu.DevGroup(label, iconname=None, permissions=[], order=None, sort_alphabetically=False, force_show=False)

Bases: Group

has_permission(context)
class basxbread.menu.Group(label, iconname=None, permissions=[], order=None, sort_alphabetically=False, force_show=False)

Bases: object

active(request)
has_permission(context)
val()
class basxbread.menu.Item(link, group, order=None)

Bases: object

active(context)
has_permission(context)
class basxbread.menu.Menu

Bases: object

registeritem(menuitem)

If menuitem.group is None this will be a top-level menu item. Otherwise the group will be created (if a group with the same label does not exists yet) and the menuitem appended to the group

class basxbread.menu.SuperUserItem(link, group, order=None)

Bases: Item

has_permission(context)
basxbread.menu.registeritem(item)

basxbread.middleware module

class basxbread.middleware.RequireAuthenticationMiddleware(get_response)

Bases: object

process_view(request, view_func, view_args, view_kwargs)

basxbread.querysetfield module

class basxbread.querysetfield.QuerySetDescriptor(field)

Bases: object

class basxbread.querysetfield.QueryValue(queryset, raw)

Bases: object

class basxbread.querysetfield.QuerysetField(*args, modelfieldname, **kwargs)

Bases: TextField

check(**kwargs)
contribute_to_class(cls, name)

Register the field with the model class it belongs to.

If private_only is True, create a separate instance of this field for every subclass of cls, even if cls is not an abstract model.

deconstruct()

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.

  • The import path of the field, including the class, e.g. django.db.models.IntegerField. This should be the most portable version, so less specific may be better.

  • A list of positional arguments.

  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict

  • UUID

  • datetime.datetime (naive), datetime.date

  • top-level classes, top-level functions - will be referenced by their full import path

  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

descriptor_class

alias of QuerySetDescriptor

formfield(**kwargs)

Return a django.forms.Field instance for this field.

get_clean_value(value)
get_db_prep_value(value, connection, prepared=False)

Return field’s value prepared for interacting with the database backend.

Used by the default implementations of get_db_prep_save().

get_prep_value(value)

Perform preliminary non-db specific value checks and conversions.

validate(value, model_instance)

Validate value and raise ValidationError if necessary. Subclasses should override this to provide validation logic.

value_to_string(obj)

Return a string value of this field from the passed obj. This is used by the serialization framework.

class basxbread.querysetfield.QuerysetFormField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)

Bases: CharField

class basxbread.querysetfield.QuerysetFormWidget(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: Textarea

django_widget

alias of QuerysetFormField

basxbread.querysetfield.parsequeryexpression(basequeryset, expression)

basxbread.urls module