Commit d92a04bc authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

add models.Dependency

parent a5b0a270
# Generated by Django 2.0.5 on 2018-07-10 14:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rainboard', '0020_erbium'),
]
operations = [
migrations.CreateModel(
name='Dependency',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('robotpkg', models.BooleanField(default=False)),
('cmake', models.BooleanField(default=False)),
('library', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rdeps', to='rainboard.Project')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dependencies', to='rainboard.Project')),
],
options={
'verbose_name_plural': 'dependencies',
},
),
migrations.AlterUniqueTogether(
name='dependency',
unique_together={('project', 'library')},
),
]
......@@ -739,6 +739,20 @@ class ContributorMail(models.Model):
return self.mail
class Dependency(models.Model):
project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='dependencies')
library = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='rdeps')
robotpkg = models.BooleanField(default=False)
cmake = models.BooleanField(default=False)
class Meta:
verbose_name_plural = 'dependencies'
unique_together = ('project', 'library')
def __str__(self):
return '{self.project} depends on {self.library}: {self.robotpkg:d} {self.cmake:d}'
def get_default_forge(project):
for forge in Forge.objects.order_by('source'):
if project.repo_set.filter(forge=forge).exists():
......
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