diff --git a/backend/django/core/forms.py b/backend/django/core/forms.py index 415854b4..b87148c3 100644 --- a/backend/django/core/forms.py +++ b/backend/django/core/forms.py @@ -136,6 +136,17 @@ class Meta: description = forms.CharField(required=False) +class ProjectUpdateAdvancedForm(forms.ModelForm): + class Meta: + model = Project + fields = ["allow_coders_view_labels"] + + def __init__(self, *args, **kwargs): + percentage_irr = kwargs.pop('percentage_irr') + super(ProjectUpdateAdvancedForm, self).__init__(*args, **kwargs) + if percentage_irr > 0: + self.fields['allow_coders_view_labels'].widget.attrs['disabled'] = 'disabled' + class LabelForm(forms.ModelForm): class Meta: model = Label @@ -263,6 +274,9 @@ class Meta: required=False, ) + allow_coders_view_labels = forms.BooleanField(initial=False, required=False) + + def clean(self): use_active_learning = self.cleaned_data.get("use_active_learning") use_default_batch_size = self.cleaned_data.get("use_default_batch_size") diff --git a/backend/django/core/migrations/0077_project_allow_coders_view_labels.py b/backend/django/core/migrations/0077_project_allow_coders_view_labels.py new file mode 100644 index 00000000..d4052300 --- /dev/null +++ b/backend/django/core/migrations/0077_project_allow_coders_view_labels.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.9 on 2024-06-12 14:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0076_auto_20230710_1905"), + ] + + operations = [ + migrations.AddField( + model_name="project", + name="allow_coders_view_labels", + field=models.BooleanField(default=False), + ), + ] diff --git a/backend/django/core/models.py b/backend/django/core/models.py index cf158854..95b01552 100644 --- a/backend/django/core/models.py +++ b/backend/django/core/models.py @@ -44,6 +44,7 @@ class Meta: num_users_irr = models.IntegerField(default=2, validators=[MinValueValidator(2)]) codebook_file = models.TextField(default="") batch_size = models.IntegerField(default=30) + allow_coders_view_labels = models.BooleanField(default=False) umbrella_string = models.TextField(blank=True) """ Advanced options """ # the current options are 'random', 'least confident', 'entropy', and 'margin sampling' diff --git a/backend/django/core/templates/projects/create/create_wizard_advanced.html b/backend/django/core/templates/projects/create/create_wizard_advanced.html index 6139d6d7..65d3547a 100644 --- a/backend/django/core/templates/projects/create/create_wizard_advanced.html +++ b/backend/django/core/templates/projects/create/create_wizard_advanced.html @@ -34,7 +34,7 @@
Train and display results for a model: {{ wizard.form.use_model }}
+{{ wizard.form.use_model }} Train and display results for a model
NOTE: This option must be checked to use Active Learning