addons-server
  • Security Bug Reports
  • External API
  • Development
  • Models
    • translations
    • amo
    • abuse
    • access
    • activity
    • addons
    • api
    • applications
    • bandwagon
    • blocklist
    • devhub
    • discovery
    • files
    • hero
    • promoted
      • promoted.PromotedGroup
        • Model Info
        • Fields
        • Reverse Relations
        • Methods
        • Custom Managers
      • promoted.PromotedAddon
      • promoted.PromotedApproval
    • ratings
    • reviewers
    • scanners
    • search
    • shelves
    • tags
    • users
    • versions
    • zadmin
  • Logs
  • IP addresses
  • Third-Party Usage
  • AMO Blocklist
  • Environments
  • Runbooks
  • External API (V3 - Deprecated)
  • External API (V4 - Frozen)
  • Playground
addons-server
  • Models
  • promoted
  • promoted.PromotedGroup
  • View page source

promoted.PromotedGroup

Model Info

Key

Value

Model Name

PromotedGroup

Verbose Name

promoted group

Verbose Name Plural

promoted groups

Docstring

A promotion group defining the promotion rules for add-ons.
NOTE: This model replaces the legacy PromotedClass and its constants

Is Abstract

False

Is Proxy

False

Is Managed

True

Ordering

[]

Permissions

[]

Default Permissions

(‘add’, ‘change’, ‘delete’, ‘view’)

Indexes

[]

Constraints

[]

Database Table

promoted_promotedgroup

Base Manager

None

Default Manager

None

File

/data/olympia/src/olympia/promoted/models.py

Starting Line Number

49

Method Resolution Order

(<class ‘olympia.promoted.models.PromotedGroup’>, <class ‘django.db.models.base.Model’>, <class ‘django.db.models.utils.AltersData’>, <class ‘object’>)

Fields

Field Name

Field Type

Database Column

Database Type

Verbose Name

active

BooleanField

active

bool

active

admin_review

BooleanField

admin_review

bool

admin review

api_name

CharField

api_name

varchar(100)

api name

autograph_signing_states

JSONField

autograph_signing_states

json

autograph signing states

badged

BooleanField

badged

bool

badged

can_be_compatible_with_all_fenix_versions

BooleanField

can_be_compatible_with_all_fenix_versions

bool

can be compatible with all fenix versions

can_primary_hero

BooleanField

can_primary_hero

bool

can primary hero

flag_for_human_review

BooleanField

flag_for_human_review

bool

flag for human review

group_id

SmallIntegerField

group_id

smallint

group id

high_profile

BooleanField

high_profile

bool

high profile

high_profile_rating

BooleanField

high_profile_rating

bool

high profile rating

id (pk)

AutoField

id

integer AUTO_INCREMENT

ID

immediate_approval

BooleanField

immediate_approval

bool

immediate approval

is_public

BooleanField

is_public

bool

is public

listed_pre_review

BooleanField

listed_pre_review

bool

listed pre review

name

CharField

name

varchar(255)

name

promoted_versions

ManyToOneRel

integer

promotedaddon

ManyToOneRel

integer

search_ranking_bump

FloatField

search_ranking_bump

double precision

search ranking bump

unlisted_pre_review

BooleanField

unlisted_pre_review

bool

unlisted pre review

fields_reverse_relation=[FieldReverseRelation(name=’promotedgroup_set’, field_type=’ManyToOneRel’, field_db_type=’integer’, related_model=’promoted.PromotedAddon’, field_name_on_related_model=’promoted_group’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’promoted_versions’, field_type=’ManyToOneRel’, field_db_type=’integer’, related_model=’promoted.PromotedApproval’, field_name_on_related_model=’promoted_group’, field_type_on_related_model=’ForeignKey’)]

Reverse Relations

Field Name

Field Type

Database Type

Related Model

Field Name on Related Model

Field Type on Related Model

promoted_versions

ManyToOneRel

integer

promoted.PromotedApproval

promoted_group

ForeignKey

promotedgroup_set

ManyToOneRel

integer

promoted.PromotedAddon

promoted_group

ForeignKey

Methods

Other Methods

Method Name

Signature

active_groups

()

badged_groups

()

get_group_id_display

(self, *, field=<django.db.models.fields.SmallIntegerField: group_id>)

Private Methods

Method Name

Signature

_get_field_value_map

(self, meta, exclude=None)

Custom Managers

default

Class: PromotedGroupManager

*Base for all managers in AMO.

Returns BaseQuerySets.

If a model has translated fields, they’ll be attached through a transform function.*

Custom Methods

all_for(self, addon)
approved_for(self, addon)
transform(self, fn)

Custom QuerySet

Class: PromotedGroupQuerySet

Represent a lazy database lookup for a set of objects.

Custom Methods
get_with_primary_fallback(self, *args, **kwargs)

*Like get(), but if using a non-default database and DoesNotExist is raised, another attempt is made using the default database instead.

Intended to be used in places where replication lag could cause the object not to exist for a brief moment and forcing use of primary db at all times is undesirable.*

no_transforms(self)
only_translations(self)

Remove all transforms except translations.

optimized_count(self)

*Slightly optimized count() for cases where there is a DISTINCT in the queryset.

When a count() call is made on a queryset that has a distinct, that causes django to run the full SELECT (including all fields, distinct, ordering etc) in a subquery and then COUNT() on the result of that subquery, which is costly/innefficient. That’s tracked in https://code.djangoproject.com/ticket/30685. We can’t easily fix the fact that there is a subquery, but we can avoid selecting all fields and ordering in that subquery needlessly.*

pop_transforms(self)
transform(self, fn)

objects

Class: PromotedGroupManager

*Base for all managers in AMO.

Returns BaseQuerySets.

If a model has translated fields, they’ll be attached through a transform function.*

Custom Methods

all_for(self, addon)
approved_for(self, addon)
transform(self, fn)

Custom QuerySet

Class: PromotedGroupQuerySet

Represent a lazy database lookup for a set of objects.

Custom Methods
get_with_primary_fallback(self, *args, **kwargs)

*Like get(), but if using a non-default database and DoesNotExist is raised, another attempt is made using the default database instead.

Intended to be used in places where replication lag could cause the object not to exist for a brief moment and forcing use of primary db at all times is undesirable.*

no_transforms(self)
only_translations(self)

Remove all transforms except translations.

optimized_count(self)

*Slightly optimized count() for cases where there is a DISTINCT in the queryset.

When a count() call is made on a queryset that has a distinct, that causes django to run the full SELECT (including all fields, distinct, ordering etc) in a subquery and then COUNT() on the result of that subquery, which is costly/innefficient. That’s tracked in https://code.djangoproject.com/ticket/30685. We can’t easily fix the fact that there is a subquery, but we can avoid selecting all fields and ordering in that subquery needlessly.*

pop_transforms(self)
transform(self, fn)

!!! THIS DOCUMENT WAS AUTOGENERATED ON 2025-10-07 !!!

Previous Next

© Copyright 2024, Mozilla.

Built with Sphinx using a theme provided by Read the Docs.