diff --git a/webapp/api/api/migrations/0080_alter_metatask_options_alter_metataskvalue_options_and_more.py b/webapp/api/api/migrations/0080_alter_metatask_options_alter_metataskvalue_options_and_more.py new file mode 100644 index 0000000..a92a99d --- /dev/null +++ b/webapp/api/api/migrations/0080_alter_metatask_options_alter_metataskvalue_options_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 5.0.6 on 2024-07-10 16:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0079_merge_20240701_2259'), + ] + + operations = [ + migrations.AlterModelOptions( + name='metatask', + options={'ordering': ['ordering', 'name']}, + ), + migrations.AlterModelOptions( + name='metataskvalue', + options={'ordering': ['ordering', 'name']}, + ), + migrations.AddField( + model_name='metatask', + name='ordering', + field=models.PositiveSmallIntegerField(default=0, help_text='the order in which the meta task will appear in the Trainer Annotation project screen'), + ), + migrations.AddField( + model_name='metataskvalue', + name='ordering', + field=models.PositiveSmallIntegerField(default=0, help_text='the order in which the meta task value will appear in the Trainer Annotation project screen'), + ), + ] diff --git a/webapp/api/api/models.py b/webapp/api/api/models.py index f505efa..db74082 100644 --- a/webapp/api/api/models.py +++ b/webapp/api/api/models.py @@ -336,6 +336,11 @@ def __str__(self): class MetaTaskValue(models.Model): name = models.CharField(max_length=150) + ordering = models.PositiveSmallIntegerField(help_text="the order in which the meta task value will appear in " + "the Trainer Annotation project screen", default=0) + + class Meta: + ordering = ['ordering', 'name'] def __str__(self): return str(self.name) @@ -346,6 +351,11 @@ class MetaTask(models.Model): values = models.ManyToManyField(MetaTaskValue, related_name='values') default = models.ForeignKey('MetaTaskValue', null=True, blank=True, on_delete=models.SET_NULL) description = models.TextField(default="", blank=True) + ordering = models.PositiveSmallIntegerField(help_text="the order in which the meta task will appear in " + "the Trainer Annotation project screen", default=0) + + class Meta: + ordering = ['ordering', 'name'] def __str__(self): return str(self.name)