From 967776a45116c3738a283b0d1b24d3c0cb27a61e Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 30 Jun 2021 13:18:02 +0100 Subject: [PATCH] Address suggestions from code review in #8237 --- readthedocs/api/v2/templates/restapi/footer.html | 2 +- readthedocs/builds/models.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/readthedocs/api/v2/templates/restapi/footer.html b/readthedocs/api/v2/templates/restapi/footer.html index bd51ebf196f..5af9c89af61 100644 --- a/readthedocs/api/v2/templates/restapi/footer.html +++ b/readthedocs/api/v2/templates/restapi/footer.html @@ -42,7 +42,7 @@
{% trans "Versions" %}
{% for version in versions %}
- {{ version.explicit_name }} + {{ version.verbose_name }}
{% endfor %} diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index 40d90a18212..3fcc706a32e 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -206,17 +206,16 @@ def explicit_name(self): For example, if a version originates from GitHub pull request #4, then ``version.explicit_name == "#4 (PR)"``. - On the other hand, Versions associated with regular ReadTheDocs builds + On the other hand, Versions associated with regular RTD builds (e.g. new tags or branches), simply return :obj:`~.verbose_name`. This means that a regular git tag named **v4** will correspond to ``version.explicit_name == "v4"``. """ - external_origin = external_version_name(self) - - if not external_origin: + if not self.is_external: return self.verbose_name template = '#{name} ({abbrev})' + external_origin = external_version_name(self) abbrev = ''.join(word[0].upper() for word in external_origin.split()) return template.format(name=self.verbose_name, abbrev=abbrev)