Django admin interface for Build and related models.


Models for the builds app.

class readthedocs.builds.models.APIVersion(*args, **kwargs)

Version proxy model for API data deserialization

This replaces the pattern where API data was deserialized into a mocked :py:cls:`Version` object. This pattern was confusing, as it was not explicit as to what form of object you were working with – API backed or database backed.

This model preserves the Version model methods, allowing for overrides on model field differences. This model pattern will generally only be used on builder instances, where we are interacting solely with API data.

class readthedocs.builds.models.Build(*args, **kwargs)

Build data.


Return if build has a finished state

class readthedocs.builds.models.BuildCommandResult(*args, **kwargs)

Build command for a Build.


Total command runtime in seconds

class readthedocs.builds.models.BuildCommandResultMixin

Mixin for common command result methods/properties

Shared methods between the database model BuildCommandResult and non-model respresentations of build command results from the API


Did the command exit with a failing exit code

Helper for inverse of successful()


Did the command exit with a successful exit code

class readthedocs.builds.models.Version(*args, **kwargs)

Version of a Project.


Clean build path for project version

Ensure build path is clean for project version. Used to ensure stale build checkouts for each project version are removed.


Return the branch name, the tag name or the revision identifier.

The result could be used as ref in a git repo, e.g. for linking to GitHub or Bitbucket.


Return version build path if path exists, otherwise None

get_github_url(docroot, filename, source_suffix='.rst', action='view')

Return a GitHub URL for a given filename.

Location of documentation in repository
Name of file
File suffix of documentation format
view (default) or edit
identifier = None

The identifier is the ID for the revision this is version is for. This might be the revision number (e.g. in SVN), or the commit hash (e.g. in Git). If the this version is pointing to a branch, then identifier will contain the branch name.


Return display friendly identifier

save(*args, **kwargs)

Add permissions to the Version for all owners on save.

slug = None

The slug is the slugified version of verbose_name that can be used in the URL to identify this version in a project. It’s also used in the filesystem to determine how the paths for this version are called. It must not be used for any other identifying purposes.

verbose_name = None

This is the actual name that we got for the commit stored in identifier. This might be the tag or branch name like "v1.0.4". However this might also hold special version names like "latest" and "stable".

class readthedocs.builds.models.VersionAlias(*args, **kwargs)

Alias for a Version.


URL configuration for builds app.


Views for builds app.