• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Djblets dev
    2. Version 5.x
    3. Version 4.x
    4. Version 3.x
    5. Version 2.x
    6. Version 2.0
    7. Version 1.0
    8. Version 0.9
    9. Djblets Documentation
    10. Module and Class References
    11. djblets.avatars.forms
  • Home
  • Guides
  • Avatar Services Guides
  • Writing Avatar Services
  • Extension Guides
  • Writing Extensions
  • Testing Extensions
  • Feature Checks Guides
  • Introduction to Feature Checks
  • Writing Features
  • Writing Feature Checkers
  • Testing with Feature Checks
  • Integration Guides
  • Supporting Integrations
  • Writing Integrations
  • Privacy Compliance Guides
  • Getting and Checking Consent
  • Working with Personally Identifiable Information
  • Service Integrations
  • reCAPTCHA Guides
  • Using reCAPTCHA
  • Registries Guides
  • Writing Registries
  • Web API Guides
  • Writing Web API Resources
  • Adding OAuth2 Support
  • Module and Class References
  • djblets
  • djblets.deprecation
  • djblets.auth.forms
  • djblets.auth.ratelimit
  • djblets.auth.signals
  • djblets.auth.util
  • djblets.auth.views
  • djblets.avatars.errors
  • djblets.avatars.forms
  • djblets.avatars.registry
  • djblets.avatars.services
  • djblets.avatars.services.base
  • djblets.avatars.services.fallback
  • djblets.avatars.services.file_upload
  • djblets.avatars.services.gravatar
  • djblets.avatars.services.url
  • djblets.avatars.settings
  • djblets.cache.backend
  • djblets.cache.backend_compat
  • djblets.cache.context_processors
  • djblets.cache.errors
  • djblets.cache.forwarding_backend
  • djblets.cache.serials
  • djblets.cache.synchronizer
  • djblets.conditions
  • djblets.conditions.choices
  • djblets.conditions.conditions
  • djblets.conditions.errors
  • djblets.conditions.operators
  • djblets.conditions.values
  • djblets.configforms.forms
  • djblets.configforms.mixins
  • djblets.configforms.pages
  • djblets.configforms.registry
  • djblets.configforms.views
  • djblets.datagrid.grids
  • djblets.db.backends.mysql.base
  • djblets.db.fields
  • djblets.db.fields.base64_field
  • djblets.db.fields.comma_separated_values_field
  • djblets.db.fields.counter_field
  • djblets.db.fields.json_field
  • djblets.db.fields.modification_timestamp_field
  • djblets.db.fields.relation_counter_field
  • djblets.db.managers
  • djblets.db.query
  • djblets.db.query_catcher
  • djblets.db.query_comparator
  • djblets.db.validators
  • djblets.extensions.admin
  • djblets.extensions.errors
  • djblets.extensions.extension
  • djblets.extensions.forms
  • djblets.extensions.hooks
  • djblets.extensions.loaders
  • djblets.extensions.manager
  • djblets.extensions.middleware
  • djblets.extensions.models
  • djblets.extensions.packaging
  • djblets.extensions.resources
  • djblets.extensions.settings
  • djblets.extensions.signals
  • djblets.extensions.staticfiles
  • djblets.extensions.testing
  • djblets.extensions.testing.testcases
  • djblets.extensions.urls
  • djblets.extensions.views
  • djblets.extensions.templatetags.djblets_extensions
  • djblets.features
  • djblets.features.checkers
  • djblets.features.decorators
  • djblets.features.errors
  • djblets.features.feature
  • djblets.features.level
  • djblets.features.registry
  • djblets.features.testing
  • djblets.features.templatetags.features
  • djblets.forms.fields
  • djblets.forms.fieldsets
  • djblets.forms.forms
  • djblets.forms.forms.key_value_form
  • djblets.forms.widgets
  • djblets.gravatars
  • djblets.gravatars.templatetags.gravatars
  • djblets.http.middleware
  • djblets.http.responses
  • djblets.integrations.errors
  • djblets.integrations.forms
  • djblets.integrations.hooks
  • djblets.integrations.integration
  • djblets.integrations.manager
  • djblets.integrations.mixins
  • djblets.integrations.models
  • djblets.integrations.urls
  • djblets.integrations.views
  • djblets.log
  • djblets.log.middleware
  • djblets.log.siteconfig
  • djblets.log.urls
  • djblets.log.views
  • djblets.mail.dmarc
  • djblets.mail.message
  • djblets.mail.testing
  • djblets.mail.utils
  • djblets.markdown
  • djblets.markdown.extensions.escape_html
  • djblets.markdown.extensions.wysiwyg
  • djblets.markdown.extensions.wysiwyg_email
  • djblets.pipeline.compilers.es6
  • djblets.pipeline.compilers.less
  • djblets.pipeline.compilers.mixins
  • djblets.pipeline.compilers.rollup
  • djblets.pipeline.compilers.typescript
  • djblets.pipeline.settings
  • djblets.privacy.consent
  • djblets.privacy.consent.base
  • djblets.privacy.consent.common
  • djblets.privacy.consent.errors
  • djblets.privacy.consent.forms
  • djblets.privacy.consent.hooks
  • djblets.privacy.consent.registry
  • djblets.privacy.consent.tracker
  • djblets.privacy.models
  • djblets.privacy.pii
  • djblets.privacy.templatetags.djblets_privacy
  • djblets.recaptcha.mixins
  • djblets.recaptcha.siteconfig
  • djblets.recaptcha.templatetags.djblets_recaptcha
  • djblets.recaptcha.widgets
  • djblets.registries
  • djblets.registries.errors
  • djblets.registries.importer
  • djblets.registries.mixins
  • djblets.registries.registry
  • djblets.registries.signals
  • djblets.secrets
  • djblets.secrets.crypto
  • djblets.secrets.token_generators
  • djblets.secrets.token_generators.base
  • djblets.secrets.token_generators.legacy_sha1
  • djblets.secrets.token_generators.registry
  • djblets.secrets.token_generators.vendor_checksum
  • djblets.siteconfig
  • djblets.siteconfig.admin
  • djblets.siteconfig.context_processors
  • djblets.siteconfig.django_settings
  • djblets.siteconfig.forms
  • djblets.siteconfig.managers
  • djblets.siteconfig.middleware
  • djblets.siteconfig.models
  • djblets.siteconfig.signals
  • djblets.siteconfig.views
  • djblets.template.caches
  • djblets.template.context
  • djblets.template.loaders.conditional_cached
  • djblets.template.loaders.namespaced_app_dirs
  • djblets.testing.decorators
  • djblets.testing.testcases
  • djblets.testing.testrunners
  • djblets.urls.context_processors
  • djblets.urls.decorators
  • djblets.urls.patterns
  • djblets.urls.resolvers
  • djblets.urls.root
  • djblets.urls.staticfiles
  • djblets.util.compat.django.core.cache
  • djblets.util.compat.python.past
  • djblets.util.contextmanagers
  • djblets.util.dates
  • djblets.util.decorators
  • djblets.util.filesystem
  • djblets.util.functional
  • djblets.util.html
  • djblets.util.http
  • djblets.util.humanize
  • djblets.util.json_utils
  • djblets.util.properties
  • djblets.util.serializers
  • djblets.util.symbols
  • djblets.util.templatetags.djblets_deco
  • djblets.util.templatetags.djblets_email
  • djblets.util.templatetags.djblets_forms
  • djblets.util.templatetags.djblets_images
  • djblets.util.templatetags.djblets_js
  • djblets.util.templatetags.djblets_utils
  • djblets.util.typing
  • djblets.util.views
  • djblets.views.generic.base
  • djblets.views.generic.etag
  • djblets.webapi.auth
  • djblets.webapi.auth.backends
  • djblets.webapi.auth.backends.api_tokens
  • djblets.webapi.auth.backends.base
  • djblets.webapi.auth.backends.basic
  • djblets.webapi.auth.backends.oauth2_tokens
  • djblets.webapi.auth.views
  • djblets.webapi.decorators
  • djblets.webapi.encoders
  • djblets.webapi.errors
  • djblets.webapi.fields
  • djblets.webapi.managers
  • djblets.webapi.models
  • djblets.webapi.oauth2_scopes
  • djblets.webapi.resources
  • djblets.webapi.resources.base
  • djblets.webapi.resources.group
  • djblets.webapi.resources.registry
  • djblets.webapi.resources.root
  • djblets.webapi.resources.user
  • djblets.webapi.resources.mixins.api_tokens
  • djblets.webapi.resources.mixins.forms
  • djblets.webapi.resources.mixins.oauth2_tokens
  • djblets.webapi.resources.mixins.queries
  • djblets.webapi.responses
  • djblets.webapi.signals
  • djblets.webapi.testing
  • djblets.webapi.testing.decorators
  • djblets.webapi.testing.testcases
  • General Index
  • Python Module Index
  • Release Notes
  • This documentation covers the in-development release of Djblets. You can see the stable Djblets documentation or all previous versions.

    djblets.avatars.forms¶

    Forms for Djblets’ avatar support.

    class AvatarServiceConfigForm(*args, **kwargs)[source]¶

    Bases: ConfigPageForm

    An avatar service configuration form.

    js_view_class: Optional[str] = 'Djblets.Avatars.ServiceSettingsFormView'[source]¶

    The optional Backbone view used to render the form.

    template_name = 'avatars/service_form.html'[source]¶

    The template used to render the form.

    avatar_service_id = None[source]¶

    The avatar service ID of the associated service.

    __init__(*args, **kwargs)[source]¶

    Initialize the configuration form.

    Parameters:
    • *args (tuple) – Additional positional arguments for the superclass constructor.

    • **kwargs (dict) – Additional keyword arguments for the superclass constructor.

    Keyword Arguments:
    • configuration (dict) – The current configuration

    • service (djblets.avatars.services.base.AvatarService) – The avatar service instance that instantiated this form.

    get_extra_context()[source]¶

    Return extra rendering context.

    Returns:

    Extra rendering context.

    Return type:

    dict

    __annotations__ = {'css_bundle_names': 'List[str]', 'form_id': 'Optional[str]', 'form_title': 'Optional[StrOrPromise]', 'js_bundle_names': 'List[str]', 'js_model_class': 'Optional[str]', 'js_view_class': 'Optional[str]', 'save_label': 'Optional[StrOrPromise]'}¶
    declared_fields = {'form_target': <django.forms.fields.CharField object>}¶
    class AvatarSettingsForm(*args, **kwargs)[source]¶

    Bases: ConfigPageForm

    The avatar settings form.

    This allows users to select the avatar service they wish to use and, if necessary, configure it (e.g., by uploading an avatar).

    form_id: Optional[str] = 'avatar'[source]¶

    The unique ID of the form.

    This must be unique across all ConfigPages at a given URL.

    form_title: Optional[StrOrPromise] = 'Avatar'[source]¶

    The displayed title for the form.

    js_view_class: Optional[str] = 'Djblets.Avatars.SettingsFormView'[source]¶

    The optional Backbone view used to render the form.

    js_model_class: Optional[str] = 'Djblets.Avatars.Settings'[source]¶

    The optional Backbone model used for the configuration form state.

    template_name = 'avatars/settings_form.html'[source]¶

    The template used to render the form.

    avatar_service_registry = None[source]¶

    The avatar service registry. Subclasses must override this.

    property is_multipart[source]¶

    Whether or not the form is multi-part.

    The form is multi-part when there is an enabled avatar service that has a multi-part configuration form.

    Returns:

    Whether or not the form is multi-part.

    Return type:

    bool

    property js_bundle_names[source]¶

    Yield the bundle names necessary.

    Each avatar service can specify a configuration form that may specify JS bundles. Since those forms are not registered through the page, we must add them this way.

    Yields:

    unicode – The names of the JS bundles to load on the page.

    property css_bundle_names[source]¶

    Yield the CSS bundle names.

    Each avatar service can specify a configuration form that may specify CSS bundles. Since those forms are not registered through the page, we must add them this way.

    Yields:

    unicode – The names of the CSS bundles to load on the page.

    __init__(*args, **kwargs)[source]¶

    Initialize the form.

    Parameters:
    • *args (tuple) – Additional Positional arguments.

    • **kwargs (dict) – Additional keyword arguments.

    clean_avatar_service_id()[source]¶

    Clean the avatar_service_id field.

    This ensures that the value corresponds to a valid and enabled avatar service.

    Returns:

    The avatar service ID.

    Return type:

    unicode

    Raises:

    django.core.exceptions.ValidationError – Raised when the avatar service ID is invalid.

    clean()[source]¶

    Clean the form.

    This will clean the avatar service configuration form of the selected avatar service (if it is configurable) and raise an exception if it is not valid.

    This will cache any sub-form errors so that they can be rendered to the user when rendering the form.

    Returns:

    The form’s cleaned data.

    Return type:

    dict

    Raises:

    ValidationError – Raised when the form for the selected avatar service is invalid.

    save()[source]¶

    Save the avatar settings.

    This method attempts to save

    get_extra_context()[source]¶

    Return the extra context for rendering the form.

    Returns:

    The extra rendering context.

    Return type:

    dict

    get_js_model_data()[source]¶

    Return the JS model data for the form.

    Returns:

    A dictionary of the model data for the form.

    Return type:

    dict

    __annotations__ = {'css_bundle_names': 'List[str]', 'form_id': 'Optional[str]', 'form_title': 'Optional[StrOrPromise]', 'js_bundle_names': 'List[str]', 'js_model_class': 'Optional[str]', 'js_view_class': 'Optional[str]', 'save_label': 'Optional[StrOrPromise]'}¶
    declared_fields = {'avatar_service_id': <django.forms.fields.ChoiceField object>, 'form_target': <django.forms.fields.CharField object>}¶

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • AvatarServiceConfigForm
      • AvatarServiceConfigForm.js_view_class
      • AvatarServiceConfigForm.template_name
      • AvatarServiceConfigForm.avatar_service_id
      • AvatarServiceConfigForm.__init__()
      • AvatarServiceConfigForm.get_extra_context()
      • AvatarServiceConfigForm.__annotations__
      • AvatarServiceConfigForm.declared_fields
    • AvatarSettingsForm
      • AvatarSettingsForm.form_id
      • AvatarSettingsForm.form_title
      • AvatarSettingsForm.js_view_class
      • AvatarSettingsForm.js_model_class
      • AvatarSettingsForm.template_name
      • AvatarSettingsForm.avatar_service_registry
      • AvatarSettingsForm.is_multipart
      • AvatarSettingsForm.js_bundle_names
      • AvatarSettingsForm.css_bundle_names
      • AvatarSettingsForm.__init__()
      • AvatarSettingsForm.clean_avatar_service_id()
      • AvatarSettingsForm.clean()
      • AvatarSettingsForm.save()
      • AvatarSettingsForm.get_extra_context()
      • AvatarSettingsForm.get_js_model_data()
      • AvatarSettingsForm.__annotations__
      • AvatarSettingsForm.declared_fields