Skip to content
Snippets Groups Projects
Commit 9622dab9 authored by Fanna Lautenbach's avatar Fanna Lautenbach
Browse files

add group to model

parent 9988cf17
No related branches found
No related tags found
2 merge requests!70Add form, url, template and view; no functionality yet,!69Group to model
# Generated by Django 4.1.5 on 2023-01-19 09:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('lofardata', '0016_alter_workspecification_inputs_and_more'),
]
operations = [
migrations.CreateModel(
name='Group',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, unique=True)),
('selected_workflow', models.CharField(blank=True, default='', max_length=500)),
('selected_workflow_tag', models.CharField(blank=True, default='', max_length=500)),
('processing_site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='lofardata.atdbprocessingsite')),
('work_specifications', models.ManyToManyField(blank=True, related_name='+', to='lofardata.workspecification')),
],
),
migrations.AddField(
model_name='workspecification',
name='group',
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='lofardata.group'),
),
]
......@@ -4,6 +4,7 @@ from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
from django.db import models, IntegrityError
from django.utils.translation import gettext_lazy as _
logger = logging.getLogger(__name__)
......@@ -109,11 +110,25 @@ class PURGE_POLICY(models.TextChoices):
DO = "do", _("do") # only purge, no workflow execution
class Group(models.Model):
"""Group to which work specification belongs"""
name = models.CharField(max_length=50, unique=True)
work_specifications = models.ManyToManyField('WorkSpecification', blank=True, related_name='+')
# ATDB info
processing_site = models.ForeignKey(ATDBProcessingSite, null=True, blank=True, on_delete=models.SET_NULL)
selected_workflow = models.CharField(max_length=500, blank=True, default='')
selected_workflow_tag = models.CharField(max_length=500, blank=True, default='')
class WorkSpecification(models.Model):
"""Work Specification"""
created_on = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.DO_NOTHING, null=True)
group = models.ForeignKey(Group, null=True, default=None, on_delete=models.SET_DEFAULT)
filters = models.JSONField(null=True)
# Input data containing sizes/urls for submission to ATDB
inputs = models.JSONField(null=True, blank=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment