versions.Version
Model Info
Key |
Value |
---|---|
Model Name |
Version |
Verbose Name |
version |
Verbose Name Plural |
versions |
Docstring |
A version is a unique iteration of an add-on. |
Is Abstract |
False |
Is Proxy |
False |
Is Managed |
True |
Ordering |
[‘-created’, ‘-modified’] |
Permissions |
[] |
Default Permissions |
(‘add’, ‘change’, ‘delete’, ‘view’) |
Indexes |
[<Index: fields=[‘addon’] name=’addon_id’>, <Index: fields=[‘license’] name=’license_id’>, <Index: fields=[‘due_date’] name=’versions_due_date_b9c73ed7’>] |
Constraints |
[<UniqueConstraint: fields=(‘addon’, ‘version’) name=’versions_addon_id_version_5a2e75b6_uniq’>] |
Database Table |
versions |
Base Manager |
unfiltered |
Default Manager |
None |
File |
/data/olympia/src/olympia/versions/models.py |
Starting Line Number |
285 |
Method Resolution Order |
(<class ‘olympia.versions.models.Version’>, <class ‘olympia.amo.models.OnChangeMixin’>, <class ‘olympia.amo.models.ModelBase’>, <class ‘olympia.amo.models.SaveUpdateMixin’>, <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 |
---|---|---|---|---|
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
ForeignKey |
addon_id |
integer UNSIGNED |
addon |
|
TextField |
approvalnotes |
longtext |
approval notes |
|
ManyToOneRel |
integer UNSIGNED |
||
|
OneToOneRel |
integer UNSIGNED |
||
|
OneToOneRel |
integer UNSIGNED |
||
|
IntegerField |
channel |
integer |
channel |
|
ManyToManyRel |
through abuse.ContentDecision_target_versions |
||
|
DateTimeField |
created |
datetime(6) |
created |
|
BooleanField |
deleted |
bool |
deleted |
|
ManyToOneRel |
integer UNSIGNED |
||
|
DateTimeField |
due_date |
datetime(6) |
due date |
|
OneToOneRel |
integer UNSIGNED |
||
|
CharField |
git_hash |
varchar(40) |
git hash |
|
DateTimeField |
human_review_date |
datetime(6) |
human review date |
|
PositiveAutoField |
id |
integer UNSIGNED AUTO_INCREMENT |
id |
|
ManyToOneRel |
integer UNSIGNED |
||
|
ForeignKey |
license_id |
integer UNSIGNED |
license |
|
DateTimeField |
modified |
datetime(6) |
modified |
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
PurifiedMarkdownField |
releasenotes |
integer UNSIGNED |
release notes |
|
OneToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
||
|
FileField |
source |
varchar(255) |
source |
|
ManyToOneRel |
integer UNSIGNED |
||
|
VersionStringField |
version |
varchar(255) |
version |
|
ManyToOneRel |
integer UNSIGNED |
||
|
ManyToOneRel |
integer UNSIGNED |
Relations
Field Name |
Field Type |
Database Column |
Database Type |
Related Model |
Related Name |
---|---|---|---|---|---|
|
ForeignKey |
addon_id |
integer UNSIGNED |
addons.Addon |
versions |
|
ForeignKey |
license_id |
integer UNSIGNED |
versions.License |
version_set |
|
PurifiedMarkdownField |
releasenotes |
integer UNSIGNED |
translations.PurifiedMarkdownTranslation |
Version_release_notes_set+ |
fields_reverse_relation=[FieldReverseRelation(name=’ContentDecision_target_versions+ (no reverse relation allowed)’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’abuse.ContentDecision_target_versions’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’ManyToManyRel’, field_db_type=’through abuse.ContentDecision_target_versions’, related_model=’abuse.ContentDecision’, field_name_on_related_model=’target_versions’, field_type_on_related_model=’ManyToManyField’), FieldReverseRelation(name=’token’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’activity.ActivityLogToken’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’activity.VersionLog’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’activity.DraftComment’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’+ (no reverse relation allowed)’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’addons.Addon’, field_name_on_related_model=’_current_version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’OneToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’blocklist.BlockVersion’, field_name_on_related_model=’version’, field_type_on_related_model=’OneToOneField’), FieldReverseRelation(name=’version_set’, field_type=’OneToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’files.File’, field_name_on_related_model=’version’, field_type_on_related_model=’OneToOneField’), FieldReverseRelation(name=’promoted_versions’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’promoted.PromotedApproval’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’ratings’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’ratings.Rating’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’OneToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’reviewers.AutoApprovalSummary’, field_name_on_related_model=’version’, field_type_on_related_model=’OneToOneField’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’reviewers.NeedsHumanReview’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’reviewers.ReviewQueueHistory’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’scannerresults’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’scanners.ScannerResult’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’scannerqueryresults’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’scanners.ScannerQueryResult’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’reviewerflags’, field_type=’OneToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’versions.VersionReviewerFlags’, field_name_on_related_model=’version’, field_type_on_related_model=’OneToOneField’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’versions.VersionProvenance’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’previews’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’versions.VersionPreview’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’apps’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’versions.ApplicationsVersions’, field_name_on_related_model=’version’, field_type_on_related_model=’ForeignKey’), FieldReverseRelation(name=’version_set’, field_type=’ManyToOneRel’, field_db_type=’integer UNSIGNED’, related_model=’versions.InstallOrigin’, field_name_on_related_model=’version’, 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 |
---|---|---|---|---|---|
|
ManyToOneRel |
integer UNSIGNED |
addons.Addon |
_current_version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
abuse.ContentDecision_target_versions |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
versions.ApplicationsVersions |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
versions.VersionPreview |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
promoted.PromotedApproval |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
ratings.Rating |
version |
ForeignKey |
|
OneToOneRel |
integer UNSIGNED |
versions.VersionReviewerFlags |
version |
OneToOneField |
|
ManyToOneRel |
integer UNSIGNED |
scanners.ScannerQueryResult |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
scanners.ScannerResult |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
activity.ActivityLogToken |
version |
ForeignKey |
|
ManyToManyRel |
through abuse.ContentDecision_target_versions |
abuse.ContentDecision |
target_versions |
ManyToManyField |
|
ManyToOneRel |
integer UNSIGNED |
activity.VersionLog |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
activity.DraftComment |
version |
ForeignKey |
|
OneToOneRel |
integer UNSIGNED |
blocklist.BlockVersion |
version |
OneToOneField |
|
OneToOneRel |
integer UNSIGNED |
files.File |
version |
OneToOneField |
|
OneToOneRel |
integer UNSIGNED |
reviewers.AutoApprovalSummary |
version |
OneToOneField |
|
ManyToOneRel |
integer UNSIGNED |
reviewers.NeedsHumanReview |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
reviewers.ReviewQueueHistory |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
versions.VersionProvenance |
version |
ForeignKey |
|
ManyToOneRel |
integer UNSIGNED |
versions.InstallOrigin |
version |
ForeignKey |
Methods
Other Methods
Method Name |
Signature |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Methods
Method Name |
Signature |
---|---|
|
|
|
|
|
|
|
|
Custom Managers
default
Class: VersionManager
*Base for all managers in AMO.
Returns BaseQuerySets.
If a model has translated fields, they’ll be attached through a transform function.*
Custom Methods
approved(self)
auto_approvable(self)
Returns a queryset filtered with just the versions that should attempted for auto-approval by the cron job.
latest_public_compatible_with(self, application, appversions, *, strict_compat_mode=False)
*Return a queryset filtering the versions so that they are public, listed, and compatible with the application and appversions parameters passed. The queryset is ordered by creation date descending, allowing the caller to get the latest compatible version available.
application
is an application id
appversions
is a dict containing min and max values, as version ints.
By default, appversions['max']
is only considered for versions that
have strict compatibility enabled, unless the strict_compat_mode
parameter is also True.
Regardless of whether appversions are passed or not, the queryset will be annotated with min_compatible_version and max_compatible_version values, corresponding to the min and max application version each Version is compatible with.*
should_have_due_date(self, negate=False)
Returns a queryset filtered to versions that should have a due date set.
If negate=True
the queryset will contain versions that should not have a
due date instead.
transform(self, fn)
valid(self)
Custom QuerySet
Class: BaseQuerySet
Represent a lazy database lookup for a set of objects.
Custom Methods
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: VersionManager
*Base for all managers in AMO.
Returns BaseQuerySets.
If a model has translated fields, they’ll be attached through a transform function.*
Custom Methods
approved(self)
auto_approvable(self)
Returns a queryset filtered with just the versions that should attempted for auto-approval by the cron job.
latest_public_compatible_with(self, application, appversions, *, strict_compat_mode=False)
*Return a queryset filtering the versions so that they are public, listed, and compatible with the application and appversions parameters passed. The queryset is ordered by creation date descending, allowing the caller to get the latest compatible version available.
application
is an application id
appversions
is a dict containing min and max values, as version ints.
By default, appversions['max']
is only considered for versions that
have strict compatibility enabled, unless the strict_compat_mode
parameter is also True.
Regardless of whether appversions are passed or not, the queryset will be annotated with min_compatible_version and max_compatible_version values, corresponding to the min and max application version each Version is compatible with.*
should_have_due_date(self, negate=False)
Returns a queryset filtered to versions that should have a due date set.
If negate=True
the queryset will contain versions that should not have a
due date instead.
transform(self, fn)
valid(self)
Custom QuerySet
Class: BaseQuerySet
Represent a lazy database lookup for a set of objects.
Custom Methods
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)
unfiltered
Class: VersionManager
*Base for all managers in AMO.
Returns BaseQuerySets.
If a model has translated fields, they’ll be attached through a transform function.*
Custom Methods
approved(self)
auto_approvable(self)
Returns a queryset filtered with just the versions that should attempted for auto-approval by the cron job.
latest_public_compatible_with(self, application, appversions, *, strict_compat_mode=False)
*Return a queryset filtering the versions so that they are public, listed, and compatible with the application and appversions parameters passed. The queryset is ordered by creation date descending, allowing the caller to get the latest compatible version available.
application
is an application id
appversions
is a dict containing min and max values, as version ints.
By default, appversions['max']
is only considered for versions that
have strict compatibility enabled, unless the strict_compat_mode
parameter is also True.
Regardless of whether appversions are passed or not, the queryset will be annotated with min_compatible_version and max_compatible_version values, corresponding to the min and max application version each Version is compatible with.*
should_have_due_date(self, negate=False)
Returns a queryset filtered to versions that should have a due date set.
If negate=True
the queryset will contain versions that should not have a
due date instead.
transform(self, fn)
valid(self)
Custom QuerySet
Class: BaseQuerySet
Represent a lazy database lookup for a set of objects.
Custom Methods
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)
unfiltered_for_relations
Class: UnfilteredVersionManagerForRelations
*Like VersionManager, but defaults to include deleted objects.
Designed to be used in reverse relations of Versions like this:
unfiltered_for_relations = UnfilteredVersionManagerForRelations() is defined in Version for this to work.*
Custom Methods
approved(self)
auto_approvable(self)
Returns a queryset filtered with just the versions that should attempted for auto-approval by the cron job.
latest_public_compatible_with(self, application, appversions, *, strict_compat_mode=False)
*Return a queryset filtering the versions so that they are public, listed, and compatible with the application and appversions parameters passed. The queryset is ordered by creation date descending, allowing the caller to get the latest compatible version available.
application
is an application id
appversions
is a dict containing min and max values, as version ints.
By default, appversions['max']
is only considered for versions that
have strict compatibility enabled, unless the strict_compat_mode
parameter is also True.
Regardless of whether appversions are passed or not, the queryset will be annotated with min_compatible_version and max_compatible_version values, corresponding to the min and max application version each Version is compatible with.*
should_have_due_date(self, negate=False)
Returns a queryset filtered to versions that should have a due date set.
If negate=True
the queryset will contain versions that should not have a
due date instead.
transform(self, fn)
valid(self)
Custom QuerySet
Class: BaseQuerySet
Represent a lazy database lookup for a set of objects.
Custom Methods
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-07-09 !!!