148 lines
7.0 KiB
Python
148 lines
7.0 KiB
Python
# Generated by Django 3.2.13 on 2023-11-30 19:02
|
|
|
|
import django.contrib.postgres.fields
|
|
from django.db import migrations, models
|
|
|
|
from django.db.migrations.operations import RunPython
|
|
|
|
def eligibility_conversion(apps, schema_editor):
|
|
Placement = apps.get_model('APIs', 'Placement')
|
|
HistoricalPlacement = apps.get_model('APIs', 'HistoricalPlacement')
|
|
for placement in Placement.objects.all():
|
|
placement.btech_allowed = True
|
|
placement.btech_allowed_branch = placement.allowed_branch
|
|
if placement.rs_eligible:
|
|
placement.mtech_allowed = True
|
|
placement.ms_allowed = True
|
|
placement.phd_allowed = True
|
|
placement.mtech_allowed_branch = placement.allowed_branch
|
|
placement.ms_allowed_branch = placement.allowed_branch
|
|
placement.phd_allowed_branch = placement.allowed_branch
|
|
placement.save()
|
|
|
|
for placement in HistoricalPlacement.objects.all():
|
|
placement.btech_allowed = True
|
|
placement.btech_allowed_branch = placement.allowed_branch
|
|
if placement.rs_eligible:
|
|
placement.mtech_allowed = True
|
|
placement.ms_allowed = True
|
|
placement.phd_allowed = True
|
|
placement.mtech_allowed_branch = placement.allowed_branch
|
|
placement.ms_allowed_branch = placement.allowed_branch
|
|
placement.phd_allowed_branch = placement.allowed_branch
|
|
placement.save()
|
|
|
|
def reverse_eligibility_conversion(apps, schema_editor):
|
|
Placement = apps.get_model('APIs', 'Placement')
|
|
HistoricalPlacement = apps.get_model('APIs', 'HistoricalPlacement')
|
|
for placement in Placement.objects.all():
|
|
placement.allowed_branch = placement.btech_allowed_branch
|
|
placement.rs_eligible = placement.mtech_allowed or placement.ms_allowed or placement.phd_allowed
|
|
placement.save()
|
|
|
|
for placement in HistoricalPlacement.objects.all():
|
|
placement.allowed_branch = placement.btech_allowed_branch
|
|
placement.rs_eligible = placement.mtech_allowed or placement.ms_allowed or placement.phd_allowed
|
|
placement.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('APIs', '0012_auto_20231010_0046'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='btech_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='btech_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='ms_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='ms_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='mtech_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='mtech_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='phd_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='historicalplacement',
|
|
name='phd_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.RenameField(
|
|
model_name='historicalstudent',
|
|
old_name='can_apply',
|
|
new_name='can_apply_placements',
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='btech_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='btech_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='ms_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='ms_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='mtech_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='mtech_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='phd_allowed',
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.AddField(
|
|
model_name='placement',
|
|
name='phd_allowed_branch',
|
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
|
),
|
|
migrations.RenameField(
|
|
model_name='student',
|
|
old_name='can_apply',
|
|
new_name='can_apply_placements',
|
|
),
|
|
migrations.RunPython(eligibility_conversion, reverse_eligibility_conversion),
|
|
]
|