diff --git a/codespeed/models.py b/codespeed/models.py index 42d97c46..7ada5a38 100644 --- a/codespeed/models.py +++ b/codespeed/models.py @@ -9,18 +9,12 @@ from django.urls import reverse from django.conf import settings from django.db import models -try: - from django.utils.encoding import python_2_unicode_compatible -except ImportError: - def python_2_unicode_compatible(arg): - return arg from .commits.github import GITHUB_URL_RE logger = logging.getLogger(__name__) -@python_2_unicode_compatible class Project(models.Model): NO_LOGS = 'N' GIT = 'G' @@ -106,7 +100,6 @@ def is_less_important_than(self, val, color): return False -@python_2_unicode_compatible class Branch(models.Model): name = models.CharField(max_length=32) project = models.ForeignKey( @@ -123,7 +116,6 @@ class Meta: verbose_name_plural = "branches" -@python_2_unicode_compatible class Revision(models.Model): # git and mercurial's SHA-1 length is 40 commitid = models.CharField(max_length=42) @@ -166,7 +158,6 @@ def clean(self): raise ValidationError("Invalid SVN commit id %s" % self.commitid) -@python_2_unicode_compatible class Executable(models.Model): name = models.CharField(max_length=30) description = models.CharField(max_length=200, blank=True) @@ -180,7 +171,6 @@ def __str__(self): return self.name -@python_2_unicode_compatible class Benchmark(models.Model): B_TYPES = ( ('C', 'Cross-project'), @@ -215,7 +205,6 @@ def clean(self): "'default_on_comparison' first.") -@python_2_unicode_compatible class Environment(models.Model): name = models.CharField(unique=True, max_length=100) cpu = models.CharField(max_length=100, blank=True) @@ -227,7 +216,6 @@ def __str__(self): return self.name -@python_2_unicode_compatible class Result(models.Model): value = models.FloatField() std_dev = models.FloatField(blank=True, null=True) @@ -252,7 +240,6 @@ class Meta: unique_together = ("revision", "executable", "benchmark", "environment") -@python_2_unicode_compatible class Report(models.Model): revision = models.ForeignKey( Revision, on_delete=models.CASCADE, related_name="reports") diff --git a/codespeed/templates/codespeed/changes_data.html b/codespeed/templates/codespeed/changes_data.html index c8900b72..54ccc93e 100644 --- a/codespeed/templates/codespeed/changes_data.html +++ b/codespeed/templates/codespeed/changes_data.html @@ -17,13 +17,13 @@ {% if rev.get_browsing_url %}{{ rev.commitid }}{% else %}{{ rev.commitid }}{% endif %} Date{{ rev.date }} - {% ifnotequal rev.branch.project.repo_type "N" %} + {% if rev.branch.project.repo_type != "N" %} Repo{{ rev.branch.project.repo_path }} - {% endifnotequal %} + {% endif %} -{% ifnotequal exe.project.repo_type 'N' %} +{% if exe.project.repo_type != 'N' %} @@ -40,5 +40,5 @@ el.load("logs/", "revisionid=" + el.data("commitid"));
-{% endifnotequal %} +{% endif %} diff --git a/codespeed/templates/codespeed/changes_table.html b/codespeed/templates/codespeed/changes_table.html index 95687e15..2b3d7e9d 100644 --- a/codespeed/templates/codespeed/changes_table.html +++ b/codespeed/templates/codespeed/changes_table.html @@ -26,7 +26,7 @@ {% endif%}{% if units.has_stddev %}{{ units.totals.min }} {% endif%}{% if units.hasmax %}{{ units.totals.max }} {% endif%}{{ units.totals.change|percentage }} - {% ifnotequal units.totals.trend "-" %}{{ units.totals.trend|floatformat:2 }}%{% else %}{{ units.totals.trend }}{% endifnotequal %} + {% if units.totals.trend != "-" %}{{ units.totals.trend|floatformat:2 }}%{% else %}{{ units.totals.trend }}{% endif %} @@ -38,7 +38,7 @@ {% endif%}{% if units.hasmin %}{{ row.val_min|floatformat:units.precission }} {% endif%}{% if units.hasmax %}{{ row.val_max|floatformat:units.precission }} {% endif%}{{ row.change|percentage }} - {% ifequal row.trend "-" %}-{% else %}{{ row.trend|floatformat:2 }}%{% endifequal %} + {% if row.trend == "-" %}-{% else %}{{ row.trend|floatformat:2 }}%{% endif %} {% endfor %} {% endfor %} diff --git a/codespeed/templates/codespeed/timeline.html b/codespeed/templates/codespeed/timeline.html index 2175a4fb..73d3f13a 100644 --- a/codespeed/templates/codespeed/timeline.html +++ b/codespeed/templates/codespeed/timeline.html @@ -54,7 +54,7 @@