Commit 0dfd7c54 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

Target.active

parent b6dc13f6
......@@ -11,6 +11,7 @@ for model in [
models.Robotpkg,
models.Image,
models.Tag,
models.Target,
models.Contributor,
models.ContributorName,
models.ContributorMail,
......
# Generated by Django 2.0.5 on 2018-07-02 09:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rainboard', '0018_remove_target_python3'),
]
operations = [
migrations.AddField(
model_name='target',
name='active',
field=models.BooleanField(default=True),
),
]
......@@ -511,8 +511,15 @@ class Branch(TimeStampedModel):
return self.repo.namespace
class ActiveQuerySet(models.QuerySet):
def active(self):
return self.filter(active=True)
class Target(NamedModel):
pass
active = models.BooleanField(default=True)
objects = ActiveQuerySet.as_manager()
# class Test(TimeStampedModel):
......@@ -558,7 +565,7 @@ class Robotpkg(NamedModel):
def update_images(self):
py3s = [False, True] if self.name.startswith('py-') else [False]
debugs = [False, True] if self.project.debug else [False]
for target in Target.objects.all():
for target in Target.objects.active():
for py3 in py3s:
for debug in debugs:
Image.objects.get_or_create(robotpkg=self, target=target, py3=py3, debug=debug)[0].update()
......
......@@ -64,7 +64,7 @@ class ProjectImagesView(ProjectTableView):
order_by = 'target'
def get_object_list(self):
return models.Image.objects.filter(robotpkg__project=self.object)
return models.Image.objects.filter(robotpkg__project=self.object, target__active=True)
class ProjectContributorsView(ProjectTableView):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment