diff --git a/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py b/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py new file mode 100644 index 0000000..091a4f8 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.13 on 2023-10-26 05:20 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0013_auto_20231022_0236'), + ] + + operations = [ + migrations.AddField( + model_name='historicalplacement', + name='allowed_degree', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=['bTech'], size=3), + ), + migrations.AddField( + model_name='placement', + name='allowed_degree', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=['bTech'], size=3), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py b/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py new file mode 100644 index 0000000..f544d0c --- /dev/null +++ b/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.13 on 2023-10-26 05:21 + +import django.contrib.postgres.fields +from django.db import migrations, models +from django.db.migrations.operations.special import RunPython + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0014_auto_20231026_1050'), + ] + + operations = [ + migrations.AlterField( + model_name='historicalplacement', + name='allowed_degree', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=list, size=3), + ), + migrations.AlterField( + model_name='placement', + name='allowed_degree', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=list, size=3), + ), + + ] diff --git a/CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py b/CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py new file mode 100644 index 0000000..92fd431 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py @@ -0,0 +1,31 @@ +# Generated by Django 3.2.13 on 2023-10-26 05:35 + +from django.db import migrations +from django.db.migrations.operations.special import RunPython + + +def convert_boolean_to_array(apps, schema_editor): + Placement = apps.get_model('APIs', 'Placement') + HistorcalPlacement = apps.get_model('APIs','historicalplacement') + for obj in Placement.objects.all(): + if obj.rs_eligible: + obj.allowed_degree = ["bTech","ms/phd","mTech"] + else: + obj.allowed_degree = ["bTech"] + obj.save() + for obj in HistorcalPlacement.objects.all(): + if obj.rs_eligible: + obj.allowed_degree = ["bTech","ms/phd","mTech"] + else: + obj.allowed_degree = ["bTech"] + obj.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0015_auto_20231026_1051'), + ] + + operations = [ + RunPython(convert_boolean_to_array) + ] diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index 043759e..44dcf5b 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -129,6 +129,11 @@ class Placement(models.Model): size=TOTAL_BATCHES, default=list ) + allowed_degree = ArrayField( + models.CharField(max_length=10,choices=DEGREE_CHOICES), + size=len(DEGREE_CHOICES), + default=list + ) allowed_branch = ArrayField( models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),