Skip to main content
Premium

FieldAggregation Whitelist

FieldAggregation accepts:

  • name – field name on the model. Relation paths are supported using __ (e.g. "category__name").
  • label – optional label exposed via the aggregate schema endpoint.
  • aggregations – list of AggregateFunctionType members allowed when this field is the target of function=. Empty means the field is not aggregable.
  • group_by – list of GroupByType members allowed when the field appears in the group_by query parameter. Empty means the field cannot be used to group.
  • prefix / postfix – optional strings rendered before / after the field's value. Exposed under the schema options key exactly like FieldSchema (e.g. a currency symbol or unit such as " Kč").

Validation runs at admin registration time, as validate_aggregate_fields() on habarico_enterprise.validation.AdminConfigurationValidator — the validator validate_configuration() delegates to. When a function or bucket form does not apply to the field's underlying Django type (e.g. SUM on a CharField, TRUNC_DAY on an IntegerField, WIDTH on a DateTimeField), the admin fails to register with ImproperlyConfigured rather than surfacing the error at request time.

count is always available when aggregate_enabled = True and does not require an entry in aggregate_fields – it simply counts the rows in the filtered queryset.