From a5907f1c7519791a1e15e104da824ad0dfa86389 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Thu, 26 Oct 2023 10:42:42 +0530 Subject: [PATCH 1/3] Added migrations to git Added degree feild in exported csv change can_apply feild to can_apply_placements --- .gitignore | 3 - CDC_Backend/APIs/admin.py | 6 +- CDC_Backend/APIs/adminViews.py | 1 + CDC_Backend/APIs/constants.py | 2 +- CDC_Backend/APIs/migrations/0001_initial.py | 341 ++++++++++++++++++ .../migrations/0002_auto_20230711_1940.py | 23 ++ .../0003_historicalinternship_internship.py | 122 +++++++ .../migrations/0004_auto_20230724_1854.py | 60 +++ .../0005_alter_internship_changed_by.py | 19 + .../migrations/0006_auto_20230724_2315.py | 24 ++ .../migrations/0007_auto_20230724_2333.py | 23 ++ .../migrations/0008_auto_20230725_0017.py | 21 ++ .../migrations/0009_auto_20230725_0254.py | 29 ++ .../migrations/0010_auto_20230725_1235.py | 24 ++ .../migrations/0011_auto_20230803_0108.py | 70 ++++ .../migrations/0012_auto_20231010_0046.py | 230 ++++++++++++ .../migrations/0013_auto_20231022_0236.py | 31 ++ CDC_Backend/APIs/migrations/__init__.py | 0 CDC_Backend/APIs/models.py | 2 +- CDC_Backend/APIs/studentViews.py | 2 +- CDC_Backend/APIs/tests/test_adminView.py | 8 +- CDC_Backend/APIs/tests/test_studentView.py | 4 +- 22 files changed, 1030 insertions(+), 15 deletions(-) create mode 100644 CDC_Backend/APIs/migrations/0001_initial.py create mode 100644 CDC_Backend/APIs/migrations/0002_auto_20230711_1940.py create mode 100644 CDC_Backend/APIs/migrations/0003_historicalinternship_internship.py create mode 100644 CDC_Backend/APIs/migrations/0004_auto_20230724_1854.py create mode 100644 CDC_Backend/APIs/migrations/0005_alter_internship_changed_by.py create mode 100644 CDC_Backend/APIs/migrations/0006_auto_20230724_2315.py create mode 100644 CDC_Backend/APIs/migrations/0007_auto_20230724_2333.py create mode 100644 CDC_Backend/APIs/migrations/0008_auto_20230725_0017.py create mode 100644 CDC_Backend/APIs/migrations/0009_auto_20230725_0254.py create mode 100644 CDC_Backend/APIs/migrations/0010_auto_20230725_1235.py create mode 100644 CDC_Backend/APIs/migrations/0011_auto_20230803_0108.py create mode 100644 CDC_Backend/APIs/migrations/0012_auto_20231010_0046.py create mode 100644 CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py create mode 100644 CDC_Backend/APIs/migrations/__init__.py diff --git a/.gitignore b/.gitignore index 40fddbd..9ef3146 100644 --- a/.gitignore +++ b/.gitignore @@ -133,9 +133,6 @@ dmypy.json ./CDC_Backend/Storage /CDC_Backend/CDC_Backend/__pycache__/ /CDC_Backend/APIs/__pycache__/ -/CDC_Backend/APIs/migrations/ -/CDC_Backend/internAPIs/__pycache__/ -/CDC_Backend/internAPIs/migrations/ /CDC_Backend/static/ /CDC_Backend/Storage/ .idea diff --git a/CDC_Backend/APIs/admin.py b/CDC_Backend/APIs/admin.py index a14a7d9..315f9f7 100644 --- a/CDC_Backend/APIs/admin.py +++ b/CDC_Backend/APIs/admin.py @@ -64,7 +64,7 @@ class StudentAdmin(ImportExportMixin, SimpleHistoryAdmin): @admin.register(Student) class Student(StudentAdmin): - list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply') + list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply_placements') search_fields = ("roll_no", "name", "phone_number") ordering = ("roll_no", "name", "batch", "branch", "phone_number") list_filter = ("batch", "branch") @@ -72,12 +72,12 @@ class Student(StudentAdmin): @admin.action(description="Deregister students") def mark_can_apply_as_no(self, request, queryset): - queryset.update(can_apply=False) + queryset.update(can_apply_placements=False) self.message_user(request, "Deregistered the users") @admin.action(description="Register students") def mark_can_apply_as_yes(self, request, queryset): - queryset.update(can_apply=True) + queryset.update(can_apply_placements=True) self.message_user(request, "Registered the users") class PlacementResources(resources.ModelResource): diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py index eb76008..c7a9b7f 100644 --- a/CDC_Backend/APIs/adminViews.py +++ b/CDC_Backend/APIs/adminViews.py @@ -443,6 +443,7 @@ def generateCSV(request, id, email, user_type): row_details.append(apl.student.phone_number) row_details.append(apl.student.branch) row_details.append(apl.student.batch) + row_details.append(apl.student.degree) row_details.append(apl.student.cpi) link = LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(apl.student.id)) + "/" + urllib.parse.quote(str(apl.resume)) row_details.append(link) diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 267d0e9..7021222 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -208,7 +208,7 @@ COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html' COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html' NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html' REMINDER_STUDENTS_OPENING_TEMPLATE = 'students_opening_reminder.html' -APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI', +APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'Degree', 'CPI', 'Resume', 'Selected', ] diff --git a/CDC_Backend/APIs/migrations/0001_initial.py b/CDC_Backend/APIs/migrations/0001_initial.py new file mode 100644 index 0000000..188b48c --- /dev/null +++ b/CDC_Backend/APIs/migrations/0001_initial.py @@ -0,0 +1,341 @@ +# Generated by Django 3.2.13 on 2023-07-09 20:05 + +import APIs.models +from django.conf import settings +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import simple_history.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Contributor', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('name', models.CharField(default='', max_length=50)), + ('email', models.EmailField(default='', max_length=50, unique=True)), + ('github_id', models.CharField(default='', max_length=50, unique=True)), + ('linkedin', models.CharField(max_length=50, null=True, unique=True)), + ('commits', models.IntegerField(default=0)), + ('image', models.CharField(default='', max_length=50, null=True)), + ], + ), + migrations.CreateModel( + name='User', + fields=[ + ('email', models.EmailField(max_length=100, primary_key=True, serialize=False)), + ('id', models.CharField(db_index=True, max_length=25)), + ('user_type', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=10), default=list, size=4)), + ('last_login_time', models.DateTimeField(default=django.utils.timezone.now)), + ], + options={ + 'verbose_name_plural': 'User', + 'unique_together': {('email', 'id')}, + }, + ), + migrations.CreateModel( + name='Student', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('roll_no', models.IntegerField()), + ('name', models.CharField(max_length=100)), + ('batch', models.CharField(choices=[['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10)), + ('branch', models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10)), + ('phone_number', models.PositiveBigIntegerField(blank=True, default=None, null=True)), + ('resumes', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('cpi', models.DecimalField(decimal_places=2, max_digits=4)), + ('can_apply', models.BooleanField(default=True, verbose_name='Registered')), + ('degree', models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD']], default='bTech', max_length=10)), + ('changed_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ], + ), + migrations.CreateModel( + name='PrePlacementOffer', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('company', models.CharField(default='', max_length=50, verbose_name='Company Name')), + ('compensation', models.IntegerField()), + ('compensation_details', models.CharField(blank=True, max_length=200)), + ('tier', models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7']], max_length=10)), + ('designation', models.CharField(default=None, max_length=100, null=True)), + ('accepted', models.BooleanField(default=None, null=True)), + ('changed_by', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='APIs.student')), + ], + ), + migrations.CreateModel( + name='Placement', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('company_name', models.CharField(max_length=50)), + ('address', models.CharField(max_length=1000)), + ('company_type', models.CharField(max_length=50)), + ('nature_of_business', models.CharField(default='', max_length=50)), + ('type_of_organisation', models.CharField(default='', max_length=50)), + ('website', models.CharField(blank=True, max_length=100)), + ('company_details', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('company_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_company_details_pdf', models.BooleanField(default=False)), + ('contact_person_name', models.CharField(max_length=100)), + ('phone_number', models.PositiveBigIntegerField()), + ('email', models.CharField(default='', max_length=50)), + ('city', models.CharField(default='', max_length=50)), + ('state', models.CharField(default='', max_length=50)), + ('country', models.CharField(default='', max_length=50)), + ('pin_code', models.IntegerField(default=None, null=True)), + ('city_type', models.CharField(choices=[['Domestic', 'Domestic'], ['International', 'International']], max_length=15)), + ('designation', models.CharField(default=None, max_length=100, null=True)), + ('description', models.CharField(default=None, max_length=1000, null=True)), + ('job_location', models.CharField(default='', max_length=50)), + ('description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_description_pdf', models.BooleanField(default=False)), + ('compensation_CTC', models.IntegerField(default=None, null=True)), + ('compensation_gross', models.IntegerField(default=None, null=True)), + ('compensation_take_home', models.IntegerField(default=None, null=True)), + ('compensation_bonus', models.IntegerField(blank=True, default=None, null=True)), + ('compensation_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_compensation_details_pdf', models.BooleanField(default=False)), + ('bond_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_rounds', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('selection_procedure_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_selection_procedure_details_pdf', models.BooleanField(default=False)), + ('tier', models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7']], default=None, max_length=10, null=True)), + ('tentative_date_of_joining', models.DateField(default=django.utils.timezone.now, verbose_name='Tentative Date')), + ('allowed_batch', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=5)), + ('allowed_branch', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10), default=list, size=4)), + ('tentative_no_of_offers', models.IntegerField(default=None, null=True)), + ('rs_eligible', models.BooleanField(default=False)), + ('other_requirements', models.CharField(blank=True, default='', max_length=1000)), + ('additional_info', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=200), blank=True, default=list, size=15)), + ('email_verified', models.BooleanField(default=False)), + ('offer_accepted', models.BooleanField(default=None, null=True)), + ('deadline_datetime', models.DateTimeField(default=APIs.models.two_day_after_today, verbose_name='Deadline Date')), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='APIs.user')), + ], + ), + migrations.CreateModel( + name='HistoricalUser', + fields=[ + ('email', models.EmailField(db_index=True, max_length=100)), + ('id', models.CharField(db_index=True, max_length=25)), + ('user_type', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=10), default=list, size=4)), + ('last_login_time', models.DateTimeField(default=django.utils.timezone.now)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'historical user', + 'verbose_name_plural': 'historical User', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='HistoricalStudent', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('roll_no', models.IntegerField()), + ('name', models.CharField(max_length=100)), + ('batch', models.CharField(choices=[['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10)), + ('branch', models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10)), + ('phone_number', models.PositiveBigIntegerField(blank=True, default=None, null=True)), + ('resumes', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('cpi', models.DecimalField(decimal_places=2, max_digits=4)), + ('can_apply', models.BooleanField(default=True, verbose_name='Registered')), + ('degree', models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD']], default='bTech', max_length=10)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ], + options={ + 'verbose_name': 'historical student', + 'verbose_name_plural': 'historical students', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='HistoricalPrePlacementOffer', + fields=[ + ('id', models.IntegerField(blank=True, db_index=True)), + ('company', models.CharField(default='', max_length=50, verbose_name='Company Name')), + ('compensation', models.IntegerField()), + ('compensation_details', models.CharField(blank=True, max_length=200)), + ('tier', models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7']], max_length=10)), + ('designation', models.CharField(default=None, max_length=100, null=True)), + ('accepted', models.BooleanField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ('student', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.student')), + ], + options={ + 'verbose_name': 'historical pre placement offer', + 'verbose_name_plural': 'historical pre placement offers', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='HistoricalPlacementApplication', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('resume', models.CharField(default=None, max_length=100, null=True)), + ('additional_info', models.JSONField(blank=True, default=None, null=True)), + ('selected', models.BooleanField(blank=True, default=None, null=True)), + ('applied_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ('placement', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.placement')), + ('student', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.student')), + ], + options={ + 'verbose_name': 'historical placement application', + 'verbose_name_plural': 'historical Placement Applications', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='HistoricalPlacement', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('company_name', models.CharField(max_length=50)), + ('address', models.CharField(max_length=1000)), + ('company_type', models.CharField(max_length=50)), + ('nature_of_business', models.CharField(default='', max_length=50)), + ('type_of_organisation', models.CharField(default='', max_length=50)), + ('website', models.CharField(blank=True, max_length=100)), + ('company_details', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('company_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_company_details_pdf', models.BooleanField(default=False)), + ('contact_person_name', models.CharField(max_length=100)), + ('phone_number', models.PositiveBigIntegerField()), + ('email', models.CharField(default='', max_length=50)), + ('city', models.CharField(default='', max_length=50)), + ('state', models.CharField(default='', max_length=50)), + ('country', models.CharField(default='', max_length=50)), + ('pin_code', models.IntegerField(default=None, null=True)), + ('city_type', models.CharField(choices=[['Domestic', 'Domestic'], ['International', 'International']], max_length=15)), + ('designation', models.CharField(default=None, max_length=100, null=True)), + ('description', models.CharField(default=None, max_length=1000, null=True)), + ('job_location', models.CharField(default='', max_length=50)), + ('description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_description_pdf', models.BooleanField(default=False)), + ('compensation_CTC', models.IntegerField(default=None, null=True)), + ('compensation_gross', models.IntegerField(default=None, null=True)), + ('compensation_take_home', models.IntegerField(default=None, null=True)), + ('compensation_bonus', models.IntegerField(blank=True, default=None, null=True)), + ('compensation_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_compensation_details_pdf', models.BooleanField(default=False)), + ('bond_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_rounds', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('selection_procedure_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_selection_procedure_details_pdf', models.BooleanField(default=False)), + ('tier', models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7']], default=None, max_length=10, null=True)), + ('tentative_date_of_joining', models.DateField(default=django.utils.timezone.now, verbose_name='Tentative Date')), + ('allowed_batch', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=5)), + ('allowed_branch', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10), default=list, size=4)), + ('tentative_no_of_offers', models.IntegerField(default=None, null=True)), + ('rs_eligible', models.BooleanField(default=False)), + ('other_requirements', models.CharField(blank=True, default='', max_length=1000)), + ('additional_info', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=200), blank=True, default=list, size=15)), + ('email_verified', models.BooleanField(default=False)), + ('offer_accepted', models.BooleanField(default=None, null=True)), + ('deadline_datetime', models.DateTimeField(default=APIs.models.two_day_after_today, verbose_name='Deadline Date')), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ], + options={ + 'verbose_name': 'historical placement', + 'verbose_name_plural': 'historical placements', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='HistoricalAdmin', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('name', models.CharField(max_length=100)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ], + options={ + 'verbose_name': 'historical admin', + 'verbose_name_plural': 'historical admins', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='Admin', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('name', models.CharField(max_length=100)), + ('changed_by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ], + ), + migrations.CreateModel( + name='PlacementApplication', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('resume', models.CharField(default=None, max_length=100, null=True)), + ('additional_info', models.JSONField(blank=True, default=None, null=True)), + ('selected', models.BooleanField(blank=True, default=None, null=True)), + ('applied_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('changed_by', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ('placement', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.placement')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='APIs.student')), + ], + options={ + 'verbose_name_plural': 'Placement Applications', + 'unique_together': {('placement_id', 'student_id')}, + }, + ), + ] diff --git a/CDC_Backend/APIs/migrations/0002_auto_20230711_1940.py b/CDC_Backend/APIs/migrations/0002_auto_20230711_1940.py new file mode 100644 index 0000000..5e7c7cd --- /dev/null +++ b/CDC_Backend/APIs/migrations/0002_auto_20230711_1940.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.13 on 2023-07-11 14:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='historicalplacementapplication', + name='offer_accepted', + field=models.BooleanField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='placementapplication', + name='offer_accepted', + field=models.BooleanField(blank=True, default=None, null=True), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0003_historicalinternship_internship.py b/CDC_Backend/APIs/migrations/0003_historicalinternship_internship.py new file mode 100644 index 0000000..d9bda89 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0003_historicalinternship_internship.py @@ -0,0 +1,122 @@ +# Generated by Django 3.2.13 on 2023-07-24 07:09 + +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion +import simple_history.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0002_auto_20230711_1940'), + ] + + operations = [ + migrations.CreateModel( + name='Internship', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('company_name', models.CharField(max_length=50)), + ('address', models.CharField(max_length=1000)), + ('company_type', models.CharField(max_length=50)), + ('nature_of_business', models.CharField(default='', max_length=50)), + ('type_of_organisation', models.CharField(default='', max_length=50)), + ('website', models.CharField(blank=True, max_length=100)), + ('company_details', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('company_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_company_details_pdf', models.BooleanField(default=False)), + ('city', models.CharField(default='', max_length=50)), + ('state', models.CharField(default='', max_length=50)), + ('country', models.CharField(default='', max_length=50)), + ('pin_code', models.IntegerField(default=None, null=True)), + ('selection_procedure_rounds', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('selection_procedure_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_selection_procedure_details_pdf', models.BooleanField(default=False)), + ('description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_description_pdf', models.BooleanField(default=False)), + ('description', models.CharField(default=None, max_length=1000, null=True)), + ('interning_period_from', models.DateField(default=None, null=True)), + ('interning_period_to', models.DateField(default=None, null=True)), + ('season', models.CharField(choices=[['summer', 'Summer'], ['winter', 'Winter'], ['autumn', 'Autumn'], ['spring', 'Spring']], default=None, max_length=10)), + ('is_work_from_home', models.BooleanField(default=False)), + ('sophomore_eligible', models.BooleanField(default=False)), + ('tentative_no_of_offers', models.IntegerField(default=None, null=True)), + ('stipend_description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_stipend_description_pdf', models.BooleanField(default=False)), + ('stipend', models.IntegerField(default=None, null=True)), + ('facilities_provided', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20), default=list, size=4)), + ('additional_facilities', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('academic_requirements', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('contact_person_name', models.CharField(max_length=100)), + ('phone_number', models.PositiveBigIntegerField()), + ('email', models.EmailField(max_length=254)), + ('contact_person_designation', models.CharField(default='', max_length=50)), + ('telephone_number', models.PositiveBigIntegerField(blank=True, default=None, null=True)), + ('email_verified', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='APIs.user')), + ], + ), + migrations.CreateModel( + name='HistoricalInternship', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('company_name', models.CharField(max_length=50)), + ('address', models.CharField(max_length=1000)), + ('company_type', models.CharField(max_length=50)), + ('nature_of_business', models.CharField(default='', max_length=50)), + ('type_of_organisation', models.CharField(default='', max_length=50)), + ('website', models.CharField(blank=True, max_length=100)), + ('company_details', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('company_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_company_details_pdf', models.BooleanField(default=False)), + ('city', models.CharField(default='', max_length=50)), + ('state', models.CharField(default='', max_length=50)), + ('country', models.CharField(default='', max_length=50)), + ('pin_code', models.IntegerField(default=None, null=True)), + ('selection_procedure_rounds', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=10)), + ('selection_procedure_details', models.CharField(blank=True, max_length=1000)), + ('selection_procedure_details_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_selection_procedure_details_pdf', models.BooleanField(default=False)), + ('description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_description_pdf', models.BooleanField(default=False)), + ('description', models.CharField(default=None, max_length=1000, null=True)), + ('interning_period_from', models.DateField(default=None, null=True)), + ('interning_period_to', models.DateField(default=None, null=True)), + ('season', models.CharField(choices=[['summer', 'Summer'], ['winter', 'Winter'], ['autumn', 'Autumn'], ['spring', 'Spring']], default=None, max_length=10)), + ('is_work_from_home', models.BooleanField(default=False)), + ('sophomore_eligible', models.BooleanField(default=False)), + ('tentative_no_of_offers', models.IntegerField(default=None, null=True)), + ('stipend_description_pdf_names', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(default=None, max_length=100, null=True), blank=True, default=list, size=5)), + ('is_stipend_description_pdf', models.BooleanField(default=False)), + ('stipend', models.IntegerField(default=None, null=True)), + ('facilities_provided', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20), default=list, size=4)), + ('additional_facilities', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('academic_requirements', models.CharField(blank=True, default=None, max_length=1000, null=True)), + ('contact_person_name', models.CharField(max_length=100)), + ('phone_number', models.PositiveBigIntegerField()), + ('email', models.EmailField(max_length=254)), + ('contact_person_designation', models.CharField(default='', max_length=50)), + ('telephone_number', models.PositiveBigIntegerField(blank=True, default=None, null=True)), + ('email_verified', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ], + options={ + 'verbose_name': 'historical internship', + 'verbose_name_plural': 'historical internships', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0004_auto_20230724_1854.py b/CDC_Backend/APIs/migrations/0004_auto_20230724_1854.py new file mode 100644 index 0000000..8fbec28 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0004_auto_20230724_1854.py @@ -0,0 +1,60 @@ +# Generated by Django 3.2.13 on 2023-07-24 13:24 + +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0003_historicalinternship_internship'), + ] + + operations = [ + migrations.AddField( + model_name='historicalinternship', + name='designation', + field=models.CharField(default='', max_length=100), + ), + migrations.AddField( + model_name='historicalinternship', + name='location', + field=models.CharField(default='', max_length=50), + ), + migrations.AddField( + model_name='historicalinternship', + name='rs_eligible', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='internship', + name='designation', + field=models.CharField(default='', max_length=100), + ), + migrations.AddField( + model_name='internship', + name='location', + field=models.CharField(default='', max_length=50), + ), + migrations.AddField( + model_name='internship', + name='rs_eligible', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='historicalinternship', + name='season', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['summer', 'Summer'], ['winter', 'Winter'], ['autumn', 'Autumn'], ['spring', 'Spring']], max_length=10), default=list, size=4), + ), + migrations.AlterField( + model_name='internship', + name='season', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['summer', 'Summer'], ['winter', 'Winter'], ['autumn', 'Autumn'], ['spring', 'Spring']], max_length=10), default=list, size=4), + ), + migrations.AlterField( + model_name='placement', + name='changed_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user'), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0005_alter_internship_changed_by.py b/CDC_Backend/APIs/migrations/0005_alter_internship_changed_by.py new file mode 100644 index 0000000..49f240f --- /dev/null +++ b/CDC_Backend/APIs/migrations/0005_alter_internship_changed_by.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.13 on 2023-07-24 13:29 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0004_auto_20230724_1854'), + ] + + operations = [ + migrations.AlterField( + model_name='internship', + name='changed_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user'), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0006_auto_20230724_2315.py b/CDC_Backend/APIs/migrations/0006_auto_20230724_2315.py new file mode 100644 index 0000000..369b74b --- /dev/null +++ b/CDC_Backend/APIs/migrations/0006_auto_20230724_2315.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.13 on 2023-07-24 17:45 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0005_alter_internship_changed_by'), + ] + + operations = [ + migrations.AddField( + model_name='historicalinternship', + name='allowed_branch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10), default=list, size=4), + ), + migrations.AddField( + model_name='internship', + name='allowed_branch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP']], max_length=10), default=list, size=4), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0007_auto_20230724_2333.py b/CDC_Backend/APIs/migrations/0007_auto_20230724_2333.py new file mode 100644 index 0000000..de4da7a --- /dev/null +++ b/CDC_Backend/APIs/migrations/0007_auto_20230724_2333.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.13 on 2023-07-24 18:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0006_auto_20230724_2315'), + ] + + operations = [ + migrations.AddField( + model_name='historicalinternship', + name='city_type', + field=models.CharField(blank=True, choices=[['Domestic', 'Domestic'], ['International', 'International']], max_length=15), + ), + migrations.AddField( + model_name='internship', + name='city_type', + field=models.CharField(blank=True, choices=[['Domestic', 'Domestic'], ['International', 'International']], max_length=15), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0008_auto_20230725_0017.py b/CDC_Backend/APIs/migrations/0008_auto_20230725_0017.py new file mode 100644 index 0000000..50ad9c7 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0008_auto_20230725_0017.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.13 on 2023-07-24 18:47 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0007_auto_20230724_2333'), + ] + + operations = [ + migrations.RemoveField( + model_name='historicalinternship', + name='type_of_organisation', + ), + migrations.RemoveField( + model_name='internship', + name='type_of_organisation', + ), + ] diff --git a/CDC_Backend/APIs/migrations/0009_auto_20230725_0254.py b/CDC_Backend/APIs/migrations/0009_auto_20230725_0254.py new file mode 100644 index 0000000..8fba8d5 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0009_auto_20230725_0254.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.13 on 2023-07-24 21:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0008_auto_20230725_0017'), + ] + + operations = [ + migrations.RemoveField( + model_name='historicalinternship', + name='contact_person_designation', + ), + migrations.RemoveField( + model_name='historicalinternship', + name='telephone_number', + ), + migrations.RemoveField( + model_name='internship', + name='contact_person_designation', + ), + migrations.RemoveField( + model_name='internship', + name='telephone_number', + ), + ] diff --git a/CDC_Backend/APIs/migrations/0010_auto_20230725_1235.py b/CDC_Backend/APIs/migrations/0010_auto_20230725_1235.py new file mode 100644 index 0000000..fb71bdd --- /dev/null +++ b/CDC_Backend/APIs/migrations/0010_auto_20230725_1235.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.13 on 2023-07-25 07:05 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0009_auto_20230725_0254'), + ] + + operations = [ + migrations.AlterField( + model_name='historicalinternship', + name='season', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Summer', 'Summer'], ['Winter', 'Winter'], ['Autumn', 'Autumn'], ['Spring', 'Spring']], max_length=10), default=list, size=4), + ), + migrations.AlterField( + model_name='internship', + name='season', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Summer', 'Summer'], ['Winter', 'Winter'], ['Autumn', 'Autumn'], ['Spring', 'Spring']], max_length=10), default=list, size=4), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0011_auto_20230803_0108.py b/CDC_Backend/APIs/migrations/0011_auto_20230803_0108.py new file mode 100644 index 0000000..23e2767 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0011_auto_20230803_0108.py @@ -0,0 +1,70 @@ +# Generated by Django 3.2.13 on 2023-08-02 19:38 + +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion +import simple_history.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0010_auto_20230725_1235'), + ] + + operations = [ + migrations.AlterField( + model_name='historicalinternship', + name='facilities_provided', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20, null=True), default=list, size=4), + ), + migrations.AlterField( + model_name='internship', + name='facilities_provided', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20, null=True), default=list, size=4), + ), + migrations.CreateModel( + name='HistoricalInternshipApplication', + fields=[ + ('id', models.CharField(db_index=True, max_length=15)), + ('resume', models.CharField(default=None, max_length=100, null=True)), + ('additional_info', models.JSONField(blank=True, default=None, null=True)), + ('selected', models.BooleanField(blank=True, default=None, null=True)), + ('applied_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ('internship', models.ForeignKey(blank=True, db_constraint=False, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.internship')), + ('student', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.student')), + ], + options={ + 'verbose_name': 'historical internship application', + 'verbose_name_plural': 'historical Internship Applications', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name='InternshipApplication', + fields=[ + ('id', models.CharField(max_length=15, primary_key=True, serialize=False)), + ('resume', models.CharField(default=None, max_length=100, null=True)), + ('additional_info', models.JSONField(blank=True, default=None, null=True)), + ('selected', models.BooleanField(blank=True, default=None, null=True)), + ('applied_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('changed_by', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ('internship', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.internship')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='APIs.student')), + ], + options={ + 'verbose_name_plural': 'Internship Applications', + 'unique_together': {('internship_id', 'student_id')}, + }, + ), + ] diff --git a/CDC_Backend/APIs/migrations/0012_auto_20231010_0046.py b/CDC_Backend/APIs/migrations/0012_auto_20231010_0046.py new file mode 100644 index 0000000..e1cc9a0 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0012_auto_20231010_0046.py @@ -0,0 +1,230 @@ +# Generated by Django 3.2.13 on 2023-10-09 19:16 + +import APIs.models +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion +import simple_history.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0011_auto_20230803_0108'), + ] + + operations = [ + migrations.AddField( + model_name='historicalinternship', + name='additional_info', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=200), blank=True, default=list, size=15), + ), + migrations.AddField( + model_name='historicalinternship', + name='allowed_batch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=6), + ), + migrations.AddField( + model_name='historicalinternship', + name='deadline_datetime', + field=models.DateTimeField(default=APIs.models.two_day_after_today, verbose_name='Deadline Date'), + ), + migrations.AddField( + model_name='historicalinternship', + name='offer_accepted', + field=models.BooleanField(default=None, null=True), + ), + migrations.AddField( + model_name='historicalinternshipapplication', + name='offer_accepted', + field=models.BooleanField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='historicalinternshipapplication', + name='stipend', + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='historicalstudent', + name='can_apply_internship', + field=models.BooleanField(default=True, verbose_name='Internship Registered'), + ), + migrations.AddField( + model_name='internship', + name='additional_info', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=200), blank=True, default=list, size=15), + ), + migrations.AddField( + model_name='internship', + name='allowed_batch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=6), + ), + migrations.AddField( + model_name='internship', + name='deadline_datetime', + field=models.DateTimeField(default=APIs.models.two_day_after_today, verbose_name='Deadline Date'), + ), + migrations.AddField( + model_name='internship', + name='offer_accepted', + field=models.BooleanField(default=None, null=True), + ), + migrations.AddField( + model_name='internshipapplication', + name='offer_accepted', + field=models.BooleanField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='internshipapplication', + name='stipend', + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='student', + name='can_apply_internship', + field=models.BooleanField(default=True, verbose_name='Internship Registered'), + ), + migrations.AlterField( + model_name='historicalinternship', + name='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.AlterField( + model_name='historicalinternship', + name='facilities_provided', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20, null=True), blank=True, default=list, size=4), + ), + migrations.AlterField( + model_name='historicalplacement', + name='allowed_batch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=6), + ), + migrations.AlterField( + model_name='historicalplacement', + name='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.AlterField( + model_name='historicalplacement', + name='tier', + field=models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7'], ['8', 'Open Tier']], default=None, max_length=10, null=True), + ), + migrations.AlterField( + model_name='historicalpreplacementoffer', + name='tier', + field=models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7'], ['8', 'Open Tier']], max_length=10), + ), + migrations.AlterField( + model_name='historicalstudent', + name='batch', + field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), + ), + migrations.AlterField( + model_name='historicalstudent', + name='branch', + field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), + ), + migrations.AlterField( + model_name='historicalstudent', + name='degree', + field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], default='bTech', max_length=10), + ), + migrations.AlterField( + model_name='historicalstudent', + name='roll_no', + field=models.CharField(db_index=True, max_length=15), + ), + migrations.AlterField( + model_name='internship', + name='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.AlterField( + model_name='internship', + name='facilities_provided', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['Accommodation', 'Accommodation'], ['Food', 'Food'], ['Transport', 'Transport'], ['Medical', 'Medical']], max_length=20, null=True), blank=True, default=list, size=4), + ), + migrations.AlterField( + model_name='placement', + name='allowed_batch', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), default=list, size=6), + ), + migrations.AlterField( + model_name='placement', + name='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.AlterField( + model_name='placement', + name='tier', + field=models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7'], ['8', 'Open Tier']], default=None, max_length=10, null=True), + ), + migrations.AlterField( + model_name='preplacementoffer', + name='tier', + field=models.CharField(choices=[['psu', 'PSU'], ['1', 'Tier 1'], ['2', 'Tier 2'], ['3', 'Tier 3'], ['4', 'Tier 4'], ['5', 'Tier 5'], ['6', 'Tier 6'], ['7', 'Tier 7'], ['8', 'Open Tier']], max_length=10), + ), + migrations.AlterField( + model_name='student', + name='batch', + field=models.CharField(choices=[['2022', '2022'], ['2021', '2021'], ['2020', '2020'], ['2019', '2019'], ['2018', '2018'], ['2017', '2017']], max_length=10), + ), + migrations.AlterField( + model_name='student', + name='branch', + field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), + ), + migrations.AlterField( + model_name='student', + name='degree', + field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], default='bTech', max_length=10), + ), + migrations.AlterField( + model_name='student', + name='roll_no', + field=models.CharField(max_length=15, unique=True), + ), + migrations.CreateModel( + name='Issues', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('title', models.CharField(default='', max_length=50)), + ('description', models.CharField(default='', max_length=200)), + ('opening_id', models.CharField(default=None, max_length=15, null=True)), + ('opening_type', models.CharField(choices=[('Placement', 'Placement'), ('Internship', 'Internship')], default='Placement', max_length=15)), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.RESTRICT, to='APIs.user')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='APIs.student')), + ], + options={ + 'verbose_name_plural': 'Issues', + }, + ), + migrations.CreateModel( + name='HistoricalIssues', + fields=[ + ('id', models.IntegerField(blank=True, db_index=True)), + ('title', models.CharField(default='', max_length=50)), + ('description', models.CharField(default='', max_length=200)), + ('opening_id', models.CharField(default=None, max_length=15, null=True)), + ('opening_type', models.CharField(choices=[('Placement', 'Placement'), ('Internship', 'Internship')], default='Placement', max_length=15)), + ('created_at', models.DateTimeField(default=None, null=True)), + ('updated_at', models.DateTimeField(default=None, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField(db_index=True)), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('changed_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.user')), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='APIs.user')), + ('student', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='APIs.student')), + ], + options={ + 'verbose_name': 'historical issues', + 'verbose_name_plural': 'historical Issues', + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': ('history_date', 'history_id'), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + ] diff --git a/CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py b/CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py new file mode 100644 index 0000000..4eef228 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py @@ -0,0 +1,31 @@ +# Generated by Django 3.2.13 on 2023-10-21 21:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('APIs', '0012_auto_20231010_0046'), + ] + + operations = [ + migrations.RemoveField( + model_name='historicalstudent', + name='can_apply', + ), + migrations.RemoveField( + model_name='student', + name='can_apply', + ), + migrations.AddField( + model_name='historicalstudent', + name='can_apply_placements', + field=models.BooleanField(default=True, verbose_name='Placement_Registered'), + ), + migrations.AddField( + model_name='student', + name='can_apply_placements', + field=models.BooleanField(default=True, verbose_name='Placement_Registered'), + ), + ] diff --git a/CDC_Backend/APIs/migrations/__init__.py b/CDC_Backend/APIs/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index bb5b9a0..043759e 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -31,7 +31,7 @@ class Student(models.Model): resumes = ArrayField(models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=10, default=list, blank=True) cpi = models.DecimalField(decimal_places=2, max_digits=4) - can_apply = models.BooleanField(default=True, verbose_name='Registered') + can_apply_placements = models.BooleanField(default=True, verbose_name='Placement_Registered') can_apply_internship = models.BooleanField(default=True, verbose_name='Internship Registered') #added for internship changed_by = models.ForeignKey(User, blank=True, on_delete=models.RESTRICT, default=None, null=True) degree = models.CharField(choices=DEGREE_CHOICES, blank=False, max_length=10, default=DEGREE_CHOICES[0][0]) diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index a324afc..579bf1b 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -179,7 +179,7 @@ def submitApplication(request, id, email, user_type): # Only Allowing Applications for Placements if data[OPENING_TYPE] == PLACEMENT: - if not student.can_apply: + if not student.can_apply_placements: return Response({'action': "Submit Application", 'message': "Student Can't Apply"}, status=status.HTTP_400_BAD_REQUEST) if not len(PlacementApplication.objects.filter( diff --git a/CDC_Backend/APIs/tests/test_adminView.py b/CDC_Backend/APIs/tests/test_adminView.py index 68764e2..67d8763 100644 --- a/CDC_Backend/APIs/tests/test_adminView.py +++ b/CDC_Backend/APIs/tests/test_adminView.py @@ -24,13 +24,13 @@ class AdminView(APITestCase): self.user4 = User.objects.create( email="200030058@iitdh.ac.in", id="200030058", user_type=[STUDENT]) self.student1 = Student.objects.create( - name='John Doe', roll_no='200010032', batch='2020', branch='CSE', cpi=9.5, id="200010032", can_apply=True, resumes=["8BSLybntULgrPPm_beehyv.pdf", "8BSLybntULgrPPm_kalera.pdf"], can_apply_internship=True) + name='John Doe', roll_no='200010032', batch='2020', branch='CSE', cpi=9.5, id="200010032", can_apply_placements=True, resumes=["8BSLybntULgrPPm_beehyv.pdf", "8BSLybntULgrPPm_kalera.pdf"], can_apply_internship=True) self.student2 = Student.objects.create( - name='Jane Doe', roll_no='200010038', batch='2020', branch='EE', cpi=9.0, id="200010038", can_apply=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) + name='Jane Doe', roll_no='200010038', batch='2020', branch='EE', cpi=9.0, id="200010038", can_apply_placements=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) self.student3 = Student.objects.create( - name='Bob Smith', roll_no='200010054', batch='2020', branch='CSE', cpi=8.5, id="200010054", can_apply=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) + name='Bob Smith', roll_no='200010054', batch='2020', branch='CSE', cpi=8.5, id="200010054", can_apply_placements=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) self.student4 = Student.objects.create( - name='Bob Marley', roll_no='200030058', batch='2020', branch='CSE', cpi=8.5, id="200030058", can_apply=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) + name='Bob Marley', roll_no='200030058', batch='2020', branch='CSE', cpi=8.5, id="200030058", can_apply_placements=True, resumes=["8BSLybntULgrPPm_beehyv.pdf"], can_apply_internship=True) self.placement1 = Placement.objects.create( company_name='ABC Corp', compensation_CTC=1000000, tier='1', id=generateRandomString(), allowed_branch=["CSE", "EE"], allowed_batch=["2020"], contact_person_name="test", phone_number="1234567890", email="test1@test.com", email_verified=True, offer_accepted=True) diff --git a/CDC_Backend/APIs/tests/test_studentView.py b/CDC_Backend/APIs/tests/test_studentView.py index f730989..91992b7 100644 --- a/CDC_Backend/APIs/tests/test_studentView.py +++ b/CDC_Backend/APIs/tests/test_studentView.py @@ -21,7 +21,7 @@ class StudentViewsTestCase(APITestCase): self.assertEqual( self.user.email, User.objects.get(id=self.user.id).email) self.student = Student.objects.create( - name="Test Student", id=self.user.id, resumes=["8BSLybntULgrPPm_beehyv.pdf"], roll_no=str(os.environ.get("ROLL_NO")), branch="CSE", batch="2020", phone_number=1234567890, changed_by=self.user, can_apply=True, + name="Test Student", id=self.user.id, resumes=["8BSLybntULgrPPm_beehyv.pdf"], roll_no=str(os.environ.get("ROLL_NO")), branch="CSE", batch="2020", phone_number=1234567890, changed_by=self.user, can_apply_placements=True, can_apply_internship=True, degree="bTech", cpi=7.95, ) self.assertEqual(self.student.name, @@ -409,7 +409,7 @@ class StudentViewsTestCase(APITestCase): RESUME_FILE_NAME: '8BSLybntULgrPPm_beehyv.pdf', ADDITIONAL_INFO: [] } - self.student.can_apply = False + self.student.can_apply_placements = False self.student.save() self.client.credentials( HTTP_AUTHORIZATION='Bearer ' + self.student_token) From 4356f3d3ea370ff36af373d14510e65e1dc54ba4 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Thu, 26 Oct 2023 11:08:52 +0530 Subject: [PATCH 2/3] create field allowed_degree --- .../migrations/0014_auto_20231026_1050.py | 24 ++++++++++++++ .../migrations/0015_auto_20231026_1051.py | 26 ++++++++++++++++ .../migrations/0016_auto_20231026_1105.py | 31 +++++++++++++++++++ CDC_Backend/APIs/models.py | 5 +++ 4 files changed, 86 insertions(+) create mode 100644 CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py create mode 100644 CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py create mode 100644 CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py 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), From 5412aef50ec951b402e7b27e5a6d941eb0bebb54 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Tue, 5 Dec 2023 01:05:40 +0530 Subject: [PATCH 3/3] remove recaptcha and added new jnf fields --- CDC_Backend/APIs/companyViews.py | 38 +++-- CDC_Backend/APIs/constants.py | 10 +- .../migrations/0013_auto_20231201_0032.py | 147 ++++++++++++++++++ .../migrations/0014_auto_20231026_1050.py | 24 --- ...022_0236.py => 0014_auto_20231201_0238.py} | 24 ++- .../migrations/0015_auto_20231026_1051.py | 26 ---- .../migrations/0016_auto_20231026_1105.py | 31 ---- CDC_Backend/APIs/models.py | 27 ++-- CDC_Backend/APIs/studentViews.py | 23 ++- CDC_Backend/APIs/utils.py | 17 +- 10 files changed, 244 insertions(+), 123 deletions(-) create mode 100644 CDC_Backend/APIs/migrations/0013_auto_20231201_0032.py delete mode 100644 CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py rename CDC_Backend/APIs/migrations/{0013_auto_20231022_0236.py => 0014_auto_20231201_0238.py} (52%) delete mode 100644 CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py delete mode 100644 CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index c8e769d..855ed5d 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -11,10 +11,11 @@ logger = logging.getLogger('db') IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION, DESCRIPTION, IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS, - IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, RS_ELIGIBLE, SELECTION_PROCEDURE_ROUNDS, - SELECTION_PROCEDURE_DETAILS, + IS_COMPENSATION_DETAILS_PDF, BTECH_ALLOWED, MTECH_ALLOWED, MS_ALLOWED, PHD_ALLOWED, + BTECH_BRANCH, MTECH_BRANCH, MS_BRANCH, PHD_BRANCH, + SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS, - RECAPTCHA_VALUE, JOB_LOCATION + JOB_LOCATION ]) def addPlacement(request): logger.info("JNF filled by " + str(request.data['email'])) @@ -23,8 +24,6 @@ def addPlacement(request): data = request.data files = request.FILES opening = Placement() - if not verify_recaptcha(data[RECAPTCHA_VALUE]): - raise Exception("Recaptcha Failed") opening.id = generateRandomString() # Add a company details in the opening @@ -36,10 +35,6 @@ def addPlacement(request): opening.website = data[WEBSITE] opening.company_details = data[COMPANY_DETAILS] opening.is_company_details_pdf = data[IS_COMPANY_DETAILS_PDF] - if data[RS_ELIGIBLE] == 'Yes': - opening.rs_eligible = True - else: - opening.rs_eligible = False if opening.is_company_details_pdf: company_details_pdf = [] @@ -198,13 +193,19 @@ def addPlacement(request): # Only Allowing Fourth Year for Placement opening.allowed_batch = [FOURTH_YEAR,] - # Check if allowed_branch are valid - if data[ALLOWED_BRANCH] is None: - raise ValueError('Allowed Branch cannot be empty') - elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES): - opening.allowed_branch = json.loads(data[ALLOWED_BRANCH]) - else: - raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES)) + opening.btech_allowed = data[BTECH_ALLOWED] == "true" + opening.mtech_allowed = data[MTECH_ALLOWED] == "true" + opening.ms_allowed = data[MS_ALLOWED] == "true" + opening.phd_allowed = data[PHD_ALLOWED] == "true" + + if opening.btech_allowed: + opening.btech_allowed_branch = json.loads(data[BTECH_BRANCH]) + if opening.mtech_allowed: + opening.mtech_allowed_branch = json.loads(data[MTECH_BRANCH]) + if opening.ms_allowed: + opening.ms_allowed_branch = json.loads(data[MS_BRANCH]) + if opening.phd_allowed: + opening.phd_allowed_branch = json.loads(data[PHD_BRANCH]) # Check if tentative_no_of_offers is integer if data[TENTATIVE_NO_OF_OFFERS].isdigit(): @@ -352,7 +353,7 @@ def autoFillInf(request): ALLOWED_BRANCH, SOPHOMORES_ELIIGIBLE, RS_ELIGIBLE, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND, FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF, SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS, - CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE]) + CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL]) def addInternship(request): logger.info("INF filled by " + str(request.data['email'])) logger.info(request.data) @@ -360,9 +361,6 @@ def addInternship(request): data = request.data files = request.FILES internship = Internship() - if not verify_recaptcha(data[RECAPTCHA_VALUE]): - raise Exception("Recaptcha Failed") - internship.id = generateRandomString() # Add a company details in the internship internship.company_name = data[COMPANY_NAME] diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 7021222..7a2c3e7 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -163,7 +163,15 @@ COMPENSATION_DETAILS_PDF = 'compensation_details_pdf' COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names' IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf' ALLOWED_BATCH = 'allowed_batch' -ALLOWED_BRANCH = 'allowed_branch' +BTECH_ALLOWED = 'btech_allowed' +MTECH_ALLOWED = 'mtech_allowed' +MS_ALLOWED = 'ms_allowed' +PHD_ALLOWED = 'phd_allowed' +BTECH_BRANCH = 'btech_branches' +MTECH_BRANCH = 'mtech_branches' +MS_BRANCH = 'ms_branches' +PHD_BRANCH = 'phd_branches' +ALLOWED_BRANCH = 'allowed_batch' RS_ELIGIBLE = 'rs_eligible' BOND_DETAILS = 'bond_details' SELECTION_PROCEDURE_ROUNDS = 'selection_procedure_rounds' diff --git a/CDC_Backend/APIs/migrations/0013_auto_20231201_0032.py b/CDC_Backend/APIs/migrations/0013_auto_20231201_0032.py new file mode 100644 index 0000000..3f31421 --- /dev/null +++ b/CDC_Backend/APIs/migrations/0013_auto_20231201_0032.py @@ -0,0 +1,147 @@ +# 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), + ] diff --git a/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py b/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py deleted file mode 100644 index 091a4f8..0000000 --- a/CDC_Backend/APIs/migrations/0014_auto_20231026_1050.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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/0013_auto_20231022_0236.py b/CDC_Backend/APIs/migrations/0014_auto_20231201_0238.py similarity index 52% rename from CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py rename to CDC_Backend/APIs/migrations/0014_auto_20231201_0238.py index 4eef228..eeb28e3 100644 --- a/CDC_Backend/APIs/migrations/0013_auto_20231022_0236.py +++ b/CDC_Backend/APIs/migrations/0014_auto_20231201_0238.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.13 on 2023-10-21 21:06 +# Generated by Django 3.2.13 on 2023-11-30 21:08 from django.db import migrations, models @@ -6,24 +6,32 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('APIs', '0012_auto_20231010_0046'), + ('APIs', '0013_auto_20231201_0032'), ] operations = [ migrations.RemoveField( - model_name='historicalstudent', - name='can_apply', + model_name='historicalplacement', + name='allowed_branch', ), migrations.RemoveField( - model_name='student', - name='can_apply', + model_name='historicalplacement', + name='rs_eligible', ), - migrations.AddField( + migrations.RemoveField( + model_name='placement', + name='allowed_branch', + ), + migrations.RemoveField( + model_name='placement', + name='rs_eligible', + ), + migrations.AlterField( model_name='historicalstudent', name='can_apply_placements', field=models.BooleanField(default=True, verbose_name='Placement_Registered'), ), - migrations.AddField( + migrations.AlterField( model_name='student', name='can_apply_placements', field=models.BooleanField(default=True, verbose_name='Placement_Registered'), diff --git a/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py b/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py deleted file mode 100644 index f544d0c..0000000 --- a/CDC_Backend/APIs/migrations/0015_auto_20231026_1051.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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 deleted file mode 100644 index 92fd431..0000000 --- a/CDC_Backend/APIs/migrations/0016_auto_20231026_1105.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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 44dcf5b..2d57c88 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -6,9 +6,6 @@ from simple_history.models import HistoricalRecords from .constants import * -# from .utils import * - - class User(models.Model): email = models.EmailField(primary_key=True, blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT) id = models.CharField(blank=False, max_length=25, db_index=True) @@ -129,19 +126,31 @@ class Placement(models.Model): size=TOTAL_BATCHES, default=list ) - allowed_degree = ArrayField( - models.CharField(max_length=10,choices=DEGREE_CHOICES), - size=len(DEGREE_CHOICES), + btech_allowed = models.BooleanField(blank=False, default=False) + btech_allowed_branch = ArrayField( + models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10), + size=TOTAL_BRANCHES, default=list ) - - allowed_branch = ArrayField( + mtech_allowed = models.BooleanField(blank=False, default=False) + mtech_allowed_branch = ArrayField( + models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10), + size=TOTAL_BRANCHES, + default=list + ) + ms_allowed = models.BooleanField(blank=False, default=False) + ms_allowed_branch = ArrayField( + models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10), + size=TOTAL_BRANCHES, + default=list + ) + phd_allowed = models.BooleanField(blank=False, default=False) + phd_allowed_branch = ArrayField( models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10), size=TOTAL_BRANCHES, default=list ) tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True) - rs_eligible = models.BooleanField(blank=False, default=False) other_requirements = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default="") additional_info = ArrayField(models.CharField(blank=True, max_length=JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT), size=15, default=list, blank=True) diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index 579bf1b..7385454 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -101,10 +101,28 @@ def getDashboard(request, id, email, user_type): try: studentDetails = get_object_or_404(Student, id=id) - placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch], - allowed_branch__contains=[studentDetails.branch], + placements = [] + if studentDetails.degree == 'bTech': + placements = Placement.objects.filter(btech_allowed = True, + btech_allowed_branch__contains=[studentDetails.branch], deadline_datetime__gte=datetime.datetime.now(), offer_accepted=True, email_verified=True).order_by('deadline_datetime') + elif studentDetails.degree == 'mTech': + placements = Placement.objects.filter(mtech_allowed = True, + mtech_allowed_branch__contains=[studentDetails.branch], + deadline_datetime__gte=datetime.datetime.now(), + offer_accepted=True, email_verified=True).order_by('deadline_datetime') + elif studentDetails.degree == 'ms': + placements = Placement.objects.filter(ms_allowed = True, + ms_allowed_branch__contains=[studentDetails.branch], + deadline_datetime__gte=datetime.datetime.now(), + offer_accepted=True, email_verified=True).order_by('deadline_datetime') + elif studentDetails.degree == 'phd': + placements = Placement.objects.filter(phd_allowed = True, + phd_allowed_branch__contains=[studentDetails.branch], + deadline_datetime__gte=datetime.datetime.now(), + offer_accepted=True, email_verified=True).order_by('deadline_datetime') + filtered_placements = placement_eligibility_filters(studentDetails, placements) placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data @@ -187,7 +205,6 @@ def submitApplication(request, id, email, user_type): application = PlacementApplication() opening = get_object_or_404(Placement, id=data[OPENING_ID], allowed_batch__contains=[student.batch], - allowed_branch__contains=[student.branch], deadline_datetime__gte=timezone.now() ) if not opening.offer_accepted or not opening.email_verified: diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 3d87410..e447779 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -261,7 +261,22 @@ def PlacementApplicationConditions(student, placement): elif int(i.tier) == 1 and int(placement.tier) != 1: return False, "Can't apply for this tier" - if student.degree != 'bTech' and not placement.rs_eligible: + if student.degree == 'bTech' and not placement.btech_allowed: + raise PermissionError("Can't apply for this placement") + if student.degree == 'mTech' and not placement.mtech_allowed: + raise PermissionError("Can't apply for this placement") + if student.degree == 'ms' and not placement.ms_allowed: + raise PermissionError("Can't apply for this placement") + if student.degree == 'phd' and not placement.phd_allowed: + raise PermissionError("Can't apply for this placement") + + if student.degree == 'bTech' and student.branch not in placement.btech_allowed_branch: + raise PermissionError("Can't apply for this placement") + if student.degree == 'mTech' and student.branch not in placement.mtech_allowed_branch: + raise PermissionError("Can't apply for this placement") + if student.degree == 'ms' and student.branch not in placement.ms_allowed_branch: + raise PermissionError("Can't apply for this placement") + if student.degree == 'phd' and student.branch not in placement.phd_allowed_branch: raise PermissionError("Can't apply for this placement") return True, "Conditions Satisfied"