Skip to content

Commit

Permalink
Merge pull request #263 from tobami/django-21-compat
Browse files Browse the repository at this point in the history
Django 2.1 compatibility
  • Loading branch information
tobami authored Feb 23, 2019
2 parents a0ee6d1 + d481eb5 commit 7e8efa5
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 34 deletions.
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
language: python
python:
- 2.7
- 3.5
branches:
only:
- master
env:
global:
- DJANGO_SETTINGS_MODULE=sample_project.settings
matrix:
- DJANGO_VERSION=1.8
- DJANGO_VERSION=1.11
matrix:
include:
- python: "2.7"
env: DJANGO_VERSION=1.11
- python: "3.5"
env: DJANGO_VERSION=1.11
- python: "3.5"
env: DJANGO_VERSION=2.1
install:
- pip install flake8
- pip install -q Django==$DJANGO_VERSION
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Change Log ==

=== Version 0.13.0 ===
* NEW #263: Added support for Django 2.1, drop support for Django 1.8


=== Version 0.12.0, November 11, 2017 ===
* NEW #230: Added support for Django 1.11
* NEW #226: Added previous and next commit navigation to the changes view
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For an overview of some application concepts see the [wiki page](https://github.

# Installation

You will need Python 2.7 or 3.4+.
You will need Python 2.7 or 3.5+.

To install dependencies and the codespeed Django app:

Expand Down
24 changes: 12 additions & 12 deletions codespeed/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('units', models.CharField(default='seconds', max_length=20)),
('lessisbetter', models.BooleanField(default=True, verbose_name='Less is better')),
('default_on_comparison', models.BooleanField(default=True, verbose_name='Default on comparison page')),
('parent', models.ForeignKey(default=None, to='codespeed.Benchmark', blank=True, help_text='allows to group benchmarks in hierarchies', null=True, verbose_name='parent')),
('parent', models.ForeignKey(default=None, to='codespeed.Benchmark', on_delete=models.CASCADE, blank=True, help_text='allows to group benchmarks in hierarchies', null=True, verbose_name='parent')),
],
),
migrations.CreateModel(
Expand Down Expand Up @@ -73,8 +73,8 @@ class Migration(migrations.Migration):
('summary', models.CharField(max_length=64, blank=True)),
('colorcode', models.CharField(default='none', max_length=10)),
('_tablecache', models.TextField(blank=True)),
('environment', models.ForeignKey(related_name='reports', to='codespeed.Environment')),
('executable', models.ForeignKey(related_name='reports', to='codespeed.Executable')),
('environment', models.ForeignKey(related_name='reports', to='codespeed.Environment', on_delete=models.CASCADE)),
('executable', models.ForeignKey(related_name='reports', to='codespeed.Executable', on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
Expand All @@ -86,9 +86,9 @@ class Migration(migrations.Migration):
('val_min', models.FloatField(null=True, blank=True)),
('val_max', models.FloatField(null=True, blank=True)),
('date', models.DateTimeField(null=True, blank=True)),
('benchmark', models.ForeignKey(related_name='results', to='codespeed.Benchmark')),
('environment', models.ForeignKey(related_name='results', to='codespeed.Environment')),
('executable', models.ForeignKey(related_name='results', to='codespeed.Executable')),
('benchmark', models.ForeignKey(related_name='results', to='codespeed.Benchmark', on_delete=models.CASCADE)),
('environment', models.ForeignKey(related_name='results', to='codespeed.Environment', on_delete=models.CASCADE)),
('executable', models.ForeignKey(related_name='results', to='codespeed.Executable', on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
Expand All @@ -100,29 +100,29 @@ class Migration(migrations.Migration):
('date', models.DateTimeField(null=True)),
('message', models.TextField(blank=True)),
('author', models.CharField(max_length=100, blank=True)),
('branch', models.ForeignKey(related_name='revisions', to='codespeed.Branch')),
('project', models.ForeignKey(related_name='revisions', blank=True, to='codespeed.Project', null=True)),
('branch', models.ForeignKey(related_name='revisions', to='codespeed.Branch', on_delete=models.CASCADE)),
('project', models.ForeignKey(related_name='revisions', blank=True, to='codespeed.Project', on_delete=models.CASCADE, null=True)),
],
),
migrations.AddField(
model_name='result',
name='revision',
field=models.ForeignKey(related_name='results', to='codespeed.Revision'),
field=models.ForeignKey(related_name='results', to='codespeed.Revision', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='report',
name='revision',
field=models.ForeignKey(related_name='reports', to='codespeed.Revision'),
field=models.ForeignKey(related_name='reports', to='codespeed.Revision', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='executable',
name='project',
field=models.ForeignKey(related_name='executables', to='codespeed.Project'),
field=models.ForeignKey(related_name='executables', to='codespeed.Project', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='branch',
name='project',
field=models.ForeignKey(related_name='branches', to='codespeed.Project'),
field=models.ForeignKey(related_name='branches', to='codespeed.Project', on_delete=models.CASCADE),
),
migrations.AlterUniqueTogether(
name='revision',
Expand Down
37 changes: 24 additions & 13 deletions codespeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def is_less_important_than(self, val, color):
@python_2_unicode_compatible
class Branch(models.Model):
name = models.CharField(max_length=32)
project = models.ForeignKey(Project, related_name="branches")
project = models.ForeignKey(
Project, on_delete=models.CASCADE, related_name="branches")

def __str__(self):
return self.project.name + ":" + self.name
Expand All @@ -122,10 +123,12 @@ class Revision(models.Model):
tag = models.CharField(max_length=20, blank=True)
date = models.DateTimeField(null=True)
message = models.TextField(blank=True)
project = models.ForeignKey(Project, related_name="revisions",
null=True, blank=True)
project = models.ForeignKey(
Project, on_delete=models.CASCADE, related_name="revisions",
null=True, blank=True)
author = models.CharField(max_length=100, blank=True)
branch = models.ForeignKey(Branch, related_name="revisions")
branch = models.ForeignKey(
Branch, on_delete=models.CASCADE, related_name="revisions")

def get_short_commitid(self):
return self.commitid[:10]
Expand Down Expand Up @@ -160,7 +163,8 @@ def clean(self):
class Executable(models.Model):
name = models.CharField(max_length=30)
description = models.CharField(max_length=200, blank=True)
project = models.ForeignKey(Project, related_name="executables")
project = models.ForeignKey(
Project, on_delete=models.CASCADE, related_name="executables")

class Meta:
unique_together = ('name', 'project')
Expand All @@ -182,7 +186,7 @@ class Benchmark(models.Model):

name = models.CharField(unique=True, max_length=100)
parent = models.ForeignKey(
'self', verbose_name="parent",
'self', on_delete=models.CASCADE, verbose_name="parent",
help_text="allows to group benchmarks in hierarchies",
null=True, blank=True, default=None)
benchmark_type = models.CharField(max_length=1, choices=B_TYPES, default='C')
Expand Down Expand Up @@ -225,10 +229,14 @@ class Result(models.Model):
q1 = models.FloatField(blank=True, null=True)
q3 = models.FloatField(blank=True, null=True)
date = models.DateTimeField(blank=True, null=True)
revision = models.ForeignKey(Revision, related_name="results")
executable = models.ForeignKey(Executable, related_name="results")
benchmark = models.ForeignKey(Benchmark, related_name="results")
environment = models.ForeignKey(Environment, related_name="results")
revision = models.ForeignKey(
Revision, on_delete=models.CASCADE, related_name="results")
executable = models.ForeignKey(
Executable, on_delete=models.CASCADE, related_name="results")
benchmark = models.ForeignKey(
Benchmark, on_delete=models.CASCADE, related_name="results")
environment = models.ForeignKey(
Environment, on_delete=models.CASCADE, related_name="results")

def __str__(self):
return u"%s: %s" % (self.benchmark.name, self.value)
Expand All @@ -239,9 +247,12 @@ class Meta:

@python_2_unicode_compatible
class Report(models.Model):
revision = models.ForeignKey(Revision, related_name="reports")
environment = models.ForeignKey(Environment, related_name="reports")
executable = models.ForeignKey(Executable, related_name="reports")
revision = models.ForeignKey(
Revision, on_delete=models.CASCADE, related_name="reports")
environment = models.ForeignKey(
Environment, on_delete=models.CASCADE, related_name="reports")
executable = models.ForeignKey(
Executable, on_delete=models.CASCADE, related_name="reports")
summary = models.CharField(max_length=64, blank=True)
colorcode = models.CharField(max_length=10, default="none")
_tablecache = models.TextField(blank=True)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Django>=1.7,<2.0
Django>=1.11,<2.2
isodate>=0.4.7,<0.6
matplotlib>=1.4.3,<2.0
2 changes: 1 addition & 1 deletion sample_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib import admin

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^', include('codespeed.urls'))
]

Expand Down

0 comments on commit 7e8efa5

Please sign in to comment.