diff --git a/FusionIIIT/applications/central_mess/migrations/0005_merge_20241116_0303.py b/FusionIIIT/applications/central_mess/migrations/0005_merge_20241116_0303.py new file mode 100644 index 000000000..50651e05b --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0005_merge_20241116_0303.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('central_mess', '0003_merge_20241110_1253'), + ('central_mess', '0004_merge_20241115_1610'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/central_mess/migrations/0006_auto_20241116_0306.py b/FusionIIIT/applications/central_mess/migrations/0006_auto_20241116_0306.py new file mode 100644 index 000000000..071692b6a --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0006_auto_20241116_0306.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:06 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('central_mess', '0005_merge_20241116_0303'), + ] + + operations = [ + migrations.AlterField( + model_name='payments', + name='payment_date', + field=models.DateField(default=datetime.date.today), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0006_merge_20241116_0303.py b/FusionIIIT/applications/globals/migrations/0006_merge_20241116_0303.py new file mode 100644 index 000000000..a9fe8bc37 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0006_merge_20241116_0303.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0005_auto_20241115_1710'), + ('globals', '0004_merge_20241115_1610'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/online_cms/migrations/0005_merge_20241116_0303.py b/FusionIIIT/applications/online_cms/migrations/0005_merge_20241116_0303.py new file mode 100644 index 000000000..81b842c6f --- /dev/null +++ b/FusionIIIT/applications/online_cms/migrations/0005_merge_20241116_0303.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('online_cms', '0003_merge_20241110_1253'), + ('online_cms', '0004_merge_20241115_1509'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/research_procedures/migrations/0004_merge_20241116_0303.py b/FusionIIIT/applications/research_procedures/migrations/0004_merge_20241116_0303.py new file mode 100644 index 000000000..28e05c2c1 --- /dev/null +++ b/FusionIIIT/applications/research_procedures/migrations/0004_merge_20241116_0303.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('research_procedures', '0003_merge_20241110_1253'), + ('research_procedures', '0003_merge_20241115_1509'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/scholarships/api/serializers.py b/FusionIIIT/applications/scholarships/api/serializers.py index 848485253..7b277bf99 100644 --- a/FusionIIIT/applications/scholarships/api/serializers.py +++ b/FusionIIIT/applications/scholarships/api/serializers.py @@ -1,7 +1,16 @@ from rest_framework import serializers from applications.academic_information.models import Student from applications.globals.models import ExtraInfo -from applications.scholarships.models import Award_and_scholarship,Previous_winner,Mcm,Director_silver,Director_gold,Notional_prize,Proficiency_dm +from applications.scholarships.models import Award_and_scholarship,Previous_winner,Mcm,Director_silver,Director_gold,Notional_prize,Proficiency_dm,Release + + + +class ReleaseSerializer(serializers.ModelSerializer): + class Meta: + model = Release + fields = '__all__' + + # This serializer is used for editing the catalog by convenor and assistant class AwardAndScholarshipSerializer(serializers.ModelSerializer): @@ -10,6 +19,7 @@ class Meta: fields = '_all_' +# this serializer is used for showing data on catalog form class AwardAndScholarshipSerializer(serializers.ModelSerializer): class Meta: model = Award_and_scholarship @@ -50,87 +60,3 @@ class Meta: - - -# class McmSerializer(serializers.ModelSerializer): -# class Meta: -# model = Mcm -# fields = [ -# 'brother_name', 'brother_occupation', 'sister_name', 'sister_occupation', -# 'income_father', 'income_mother', 'income_other', 'father_occ', 'mother_occ', -# 'father_occ_desc', 'mother_occ_desc', 'four_wheeler', 'four_wheeler_desc', -# 'two_wheeler', 'two_wheeler_desc', 'house', 'plot_area', 'constructed_area', -# 'school_fee', 'school_name', 'bank_name', 'loan_amount', 'college_fee', -# 'college_name', 'income_certificate', 'forms', 'status', 'student', -# 'annual_income', 'date', 'award_id' -# ] - - -# class NotionalPrizeSerializer(serializers.ModelSerializer): -# class Meta: -# model = Notional_prize -# fields = ['spi', 'cpi', 'year', 'award_id'] - - -# class ReleaseSerializer(serializers.ModelSerializer): -# class Meta: -# model = Release -# fields = [ -# 'date_time', 'programme', 'startdate', 'enddate', 'award', -# 'remarks', 'batch', 'notif_visible' -# ] - -# class NotificationSerializer(serializers.ModelSerializer): -# class Meta: -# model = Notification -# fields = [ -# 'release_id', 'student_id', 'notification_mcm_flag', -# 'notification_convocation_flag', 'invite_mcm_accept_flag', -# 'invite_convocation_accept_flag' -# ] - -# class ApplicationSerializer(serializers.ModelSerializer): -# class Meta: -# model = Application -# fields = ['application_id', 'student_id', 'applied_flag', 'award'] - - -# class DirectorSilverSerializer(serializers.ModelSerializer): -# class Meta: -# model = Director_silver -# fields = [ -# 'nearest_policestation', 'nearest_railwaystation', 'correspondence_address', -# 'student', 'award_id', 'award_type', 'status', 'relevant_document', 'date', -# 'financial_assistance', 'grand_total', 'inside_achievements', 'justification', -# 'outside_achievements' -# ] - - - -# class ProficiencyDmSerializer(serializers.ModelSerializer): -# class Meta: -# model = Proficiency_dm -# fields = [ -# 'relevant_document', 'title_name', 'student', 'award_id', 'award_type', -# 'status', 'nearest_policestation', 'nearest_railwaystation', -# 'correspondence_address', 'no_of_students', 'date', 'roll_no1', 'roll_no2', -# 'roll_no3', 'roll_no4', 'roll_no5', 'financial_assistance', -# 'brief_description', 'justification', 'grand_total', 'ece_topic', 'cse_topic', -# 'mech_topic', 'design_topic', 'ece_percentage', 'cse_percentage', -# 'mech_percentage', 'design_percentage' -# ] - - -# class DirectorGoldSerializer(serializers.ModelSerializer): -# class Meta: -# model = Director_gold -# fields = [ -# 'student', 'status', 'correspondence_address', 'nearest_policestation', -# 'nearest_railwaystation', 'relevant_document', 'date', 'award_id', -# 'financial_assistance', 'academic_achievements', 'science_inside', -# 'science_outside', 'games_inside', 'games_outside', 'cultural_inside', -# 'cultural_outside', 'social', 'corporate', 'hall_activities', -# 'gymkhana_activities', 'institute_activities', 'counselling_activities', -# 'other_activities', 'justification', 'grand_total' -# ] - diff --git a/FusionIIIT/applications/scholarships/api/views.py b/FusionIIIT/applications/scholarships/api/views.py index ae9fc5058..26d6145f9 100644 --- a/FusionIIIT/applications/scholarships/api/views.py +++ b/FusionIIIT/applications/scholarships/api/views.py @@ -2,12 +2,21 @@ from rest_framework.response import Response from rest_framework.decorators import api_view from rest_framework import status -from applications.scholarships.models import Previous_winner, Award_and_scholarship,Mcm,Director_gold,Notional_prize,Director_silver,Proficiency_dm +from applications.scholarships.models import Previous_winner, Award_and_scholarship,Mcm,Director_gold,Notional_prize,Director_silver,Proficiency_dm,Release from applications.academic_information.models import Spi, Student from applications.globals.models import (Designation, ExtraInfo, HoldsDesignation) from rest_framework import viewsets -from applications.scholarships.api.serializers import PreviousWinnerSerializer,AwardAndScholarshipSerializer,McmSerializer,NotionalPrizeSerializer,DirectorGoldSerializer,DirectorSilverSerializer,ProficiencyDmSerializer +from applications.scholarships.api.serializers import PreviousWinnerSerializer,AwardAndScholarshipSerializer,McmSerializer,NotionalPrizeSerializer,DirectorGoldSerializer,DirectorSilverSerializer,ProficiencyDmSerializer,ReleaseSerializer + + +class ReleaseCreateView(APIView): + def post(self, request): + serializer = ReleaseSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() # Save the data to the database + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @@ -77,6 +86,7 @@ def post(self, request, *args, **kwargs): else: return Response({'result': 'Failure', 'error': 'No winners found'}, status=status.HTTP_404_NOT_FOUND) + class McmUpdateView(APIView): def post(self, request): serializer = McmSerializer(data=request.data) @@ -85,6 +95,7 @@ def post(self, request): return Response(McmSerializer(mcm_instance).data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class McmRetrieveView(APIView): def post(self, request): roll_number = request.data.get('roll_number') @@ -100,6 +111,8 @@ def post(self, request): serializer = McmSerializer(mcm_data, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class DirectorSilverRetrieveView(APIView): def post(self, request): roll_number = request.data.get('roll_number') @@ -115,6 +128,8 @@ def post(self, request): serializer = DirectorSilverSerializer(director_silver_data, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class DirectorSilverUpdateView(APIView): def post(self, request): serializer = DirectorSilverSerializer(data=request.data) @@ -137,6 +152,8 @@ def post(self, request): serializer = DirectorGoldSerializer(director_gold_data, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class DirectorGoldUpdateView(APIView): def post(self, request): serializer = DirectorGoldSerializer(data=request.data) @@ -144,6 +161,8 @@ def post(self, request): director_gold_instance = serializer.save() return Response(DirectorGoldSerializer(director_gold_instance).data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class ProficiencyDmUpdateView(APIView): def post(self, request): serializer = ProficiencyDmSerializer(data=request.data) @@ -151,6 +170,8 @@ def post(self, request): proficiency_dm_instance = serializer.save() return Response(ProficiencyDmSerializer(proficiency_dm_instance).data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class ProficiencyDmRetrieveView(APIView): def post(self, request): roll_number = request.data.get('roll_number') @@ -167,6 +188,7 @@ def post(self, request): return Response(serializer.data, status=status.HTTP_200_OK) + class ScholarshipDetailView(APIView): def get(self, request): # Fetch all records from the Mcm table @@ -175,6 +197,17 @@ def get(self, request): serializer = McmSerializer(mcm_data, many=True) # Return the serialized data as a response return Response(serializer.data, status=status.HTTP_200_OK) + + +class DirectorGoldListView(APIView): + def get(self, request): + # Fetch all entries + director_gold_entries = Director_gold.objects.all() + # Serialize all entries + serializer = DirectorGoldSerializer(director_gold_entries, many=True) + # Return the serialized data as a response + return Response(serializer.data, status=status.HTTP_200_OK) + class StudentDetailView(APIView): def post(self, request): @@ -189,3 +222,36 @@ def post(self, request): serializer = McmSerializer(mcm_entry) return Response(serializer.data, status=status.HTTP_200_OK) + + +class DirectorSilverDetailView(APIView): + def post(self, request): + student_id = request.data.get('student') + + if not student_id: + return Response({"error": "Student ID is required."}, status=status.HTTP_400_BAD_REQUEST) + + try: + director_silver_entry = Director_silver.objects.get(student__id=student_id) + except Director_silver.DoesNotExist: + return Response({"error": "No record found for the given student ID."}, status=status.HTTP_404_NOT_FOUND) + + serializer = DirectorSilverSerializer(director_silver_entry) + return Response(serializer.data, status=status.HTTP_200_OK) + + + +class DirectorGoldDetailView(APIView): + def post(self, request): + student_id = request.data.get('student') + + if not student_id: + return Response({"error": "Student ID is required."}, status=status.HTTP_400_BAD_REQUEST) + + try: + director_gold_entry = Director_gold.objects.get(student__id=student_id) + except Director_gold.DoesNotExist: + return Response({"error": "No record found for the given student ID."}, status=status.HTTP_404_NOT_FOUND) + + serializer = DirectorGoldSerializer(director_gold_entry) + return Response(serializer.data, status=status.HTTP_200_OK) diff --git a/FusionIIIT/applications/scholarships/migrations/0003_auto_20241116_0306.py b/FusionIIIT/applications/scholarships/migrations/0003_auto_20241116_0306.py new file mode 100644 index 000000000..e4784dd40 --- /dev/null +++ b/FusionIIIT/applications/scholarships/migrations/0003_auto_20241116_0306.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-11-16 03:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('scholarships', '0002_auto_20241115_1710'), + ] + + operations = [ + migrations.RenameField( + model_name='mcm', + old_name='marksheet', + new_name='Marksheet', + ), + ] diff --git a/FusionIIIT/applications/scholarships/models.py b/FusionIIIT/applications/scholarships/models.py index d7ceee0e2..3cf7910fb 100755 --- a/FusionIIIT/applications/scholarships/models.py +++ b/FusionIIIT/applications/scholarships/models.py @@ -76,15 +76,6 @@ class Meta: def __str__(self): return self.award_name -# class Award_and_scholarship(models.Model): -# award_name = models.CharField(max_length=100, default='') -# catalog = models.TextField(max_length=5000, blank=True, null=False) # blank=True for forms, null=True for database - -# class Meta: -# db_table = 'Award_and_scholarship' - -# def __str__(self): -# return self.award_name class Mcm(models.Model): @@ -293,3 +284,8 @@ class Director_gold(models.Model): class Meta: db_table = 'Director_gold' + + + + + diff --git a/FusionIIIT/applications/scholarships/urls.py b/FusionIIIT/applications/scholarships/urls.py index 5708a3697..61c37fe21 100755 --- a/FusionIIIT/applications/scholarships/urls.py +++ b/FusionIIIT/applications/scholarships/urls.py @@ -5,7 +5,7 @@ from . import views from applications.scholarships.api.views import GetWinnersView from applications.scholarships.api.views import create_award,McmUpdateView, McmRetrieveView, DirectorSilverRetrieveView,DirectorSilverUpdateView,DirectorGoldRetrieveView,DirectorGoldUpdateView,ProficiencyDmRetrieveView,ProficiencyDmUpdateView,AwardAndScholarshipCreateView -from applications.scholarships.api.views import ScholarshipDetailView,StudentDetailView +from applications.scholarships.api.views import ScholarshipDetailView,StudentDetailView,DirectorSilverDetailView,DirectorGoldDetailView,DirectorGoldListView,ReleaseCreateView app_name = 'spacs' @@ -23,7 +23,7 @@ url(r'^getConvocationFlag/$', views.getConvocationFlag, name='getConvocationFlag'), url(r'^getContent/$', views.getContent, name='getContent'), url(r'^updateEndDate/$', views.updateEndDate, name='updateEndDate'), - #app + #app --> url(r'get-winners/', GetWinnersView.as_view(), name='get-winners'), url(r'create-award/', create_award.as_view(), name='create-award'), url(r'mcm_update/', McmUpdateView.as_view(), name='mcm-update'), @@ -37,9 +37,10 @@ path('award/', AwardAndScholarshipCreateView.as_view(), name='award-create'), # URL for creating a new award path('scholarship-details/', ScholarshipDetailView.as_view(), name='scholarship-list'), + path('director_gold_list/', DirectorGoldListView.as_view(), name='director_gold_list'), #path('scholarship-details//', ScholarshipDetailView.as_view(), name='scholarship-detail'), - url(r'student_file_show/', StudentDetailView.as_view(), name='student-file-show') - - - + url(r'student_file_show/', StudentDetailView.as_view(), name='student-file-show'), + path('director_silver_show/', DirectorSilverDetailView.as_view(), name='director_silver_detail'), + path('director_gold_view/', DirectorGoldDetailView.as_view(), name='director_gold_detail'), + path('release', ReleaseCreateView.as_view(), name='release_create'), ] \ No newline at end of file