Commit 11725f20 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

define main distribution

parent 3b6e2f4a
Pipeline #8051 passed with stage
in 22 seconds
# Generated by Django 2.2.9 on 2020-01-17 17:34
from django.db import migrations, models
def main_bionic(apps, schema_editor):
Target = apps.get_model('rainboard', 'Target')
Target.objects.filter(name='18.04').update(main=True)
class Migration(migrations.Migration):
dependencies = [
('rainboard', '0040_robotpkg_same_py'),
]
operations = [
migrations.AddField(
model_name='target',
name='main',
field=models.BooleanField(default=False),
),
migrations.RunPython(main_bionic),
]
...@@ -3,8 +3,6 @@ import logging ...@@ -3,8 +3,6 @@ import logging
import re import re
from subprocess import check_output from subprocess import check_output
import git
import requests
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
...@@ -15,6 +13,9 @@ from django.utils import timezone ...@@ -15,6 +13,9 @@ from django.utils import timezone
from django.utils.dateparse import parse_datetime from django.utils.dateparse import parse_datetime
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import requests
import git
from autoslug import AutoSlugField from autoslug import AutoSlugField
from ndh.models import Links, NamedModel, TimeStampedModel from ndh.models import Links, NamedModel, TimeStampedModel
from ndh.utils import enum_to_choices, query_sum from ndh.utils import enum_to_choices, query_sum
...@@ -703,15 +704,19 @@ class Branch(TimeStampedModel): ...@@ -703,15 +704,19 @@ class Branch(TimeStampedModel):
return self.repo.namespace return self.repo.namespace
class ActiveQuerySet(models.QuerySet): class TargetQuerySet(models.QuerySet):
def active(self): def active(self):
return self.filter(active=True) return self.filter(active=True)
def main(self):
return self.get(main=True)
class Target(NamedModel): class Target(NamedModel):
active = models.BooleanField(default=True) active = models.BooleanField(default=True)
main = models.BooleanField(default=False)
objects = ActiveQuerySet.as_manager() objects = TargetQuerySet.as_manager()
# class Test(TimeStampedModel): # class Test(TimeStampedModel):
......
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