create field allowed_degree

This commit is contained in:
karthikmurakonda 2023-10-26 11:08:52 +05:30
parent a5907f1c75
commit 4356f3d3ea
4 changed files with 86 additions and 0 deletions

View File

@ -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),
),
]

View File

@ -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),
),
]

View File

@ -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)
]

View File

@ -129,6 +129,11 @@ class Placement(models.Model):
size=TOTAL_BATCHES, size=TOTAL_BATCHES,
default=list default=list
) )
allowed_degree = ArrayField(
models.CharField(max_length=10,choices=DEGREE_CHOICES),
size=len(DEGREE_CHOICES),
default=list
)
allowed_branch = ArrayField( allowed_branch = ArrayField(
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10), models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),