From 028d910ec249de39bac54b6f86ffd7fe956dd10b Mon Sep 17 00:00:00 2001 From: Blanca-Vern-2nd Date: Mon, 14 Oct 2024 19:40:38 +0530 Subject: [PATCH 01/11] feat(feature): Added GymKhaanna APIs & DB Changes --- FusionIIIT/applications/gymkhana/admin.py | 13 +- .../applications/gymkhana/api/serializers.py | 32 ++- FusionIIIT/applications/gymkhana/api/views.py | 266 +++++++++++++----- .../migrations/0002_auto_20241013_2251.py | 98 +++++++ FusionIIIT/applications/gymkhana/models.py | 228 ++++++++++----- FusionIIIT/applications/gymkhana/urls.py | 35 ++- FusionIIIT/applications/gymkhana/views.py | 74 ++--- 7 files changed, 529 insertions(+), 217 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py diff --git a/FusionIIIT/applications/gymkhana/admin.py b/FusionIIIT/applications/gymkhana/admin.py index 10dd3b792..4f229113e 100644 --- a/FusionIIIT/applications/gymkhana/admin.py +++ b/FusionIIIT/applications/gymkhana/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import (Club_budget,Club_info,Club_member,Club_report,Core_team,Fest_budget,Other_report,Session_info,Voting_choices,Voting_polls,Voting_voters,Event_info,Registration_form,Form_available,Inventory) +from .models import (Club_budget,Club_info,Club_member,Club_report,Fest_budget,Other_report,Session_info,Event_info,Registration_form,Form_available,Inventory,Budget,Budget_Comments,Event_Comments) # Register your models here. @@ -15,16 +15,19 @@ class ClubMemberAdmin(admin.ModelAdmin): admin.site.register(Club_info, ClubInfoAdmin) admin.site.register(Club_member, ClubMemberAdmin) -admin.site.register(Core_team) +# admin.site.register(Core_team) admin.site.register(Club_budget) admin.site.register(Session_info) admin.site.register(Event_info) admin.site.register(Club_report) admin.site.register(Fest_budget) admin.site.register(Other_report) -admin.site.register(Voting_polls) -admin.site.register(Voting_choices) -admin.site.register(Voting_voters) +# admin.site.register(Voting_polls) +# admin.site.register(Voting_choices) +# admin.site.register(Voting_voters) admin.site.register(Registration_form) admin.site.register(Form_available) admin.site.register(Inventory) +admin.site.register(Budget) +admin.site.register(Budget_Comments) +admin.site.register(Event_Comments) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 77a92726c..afbb91223 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -2,13 +2,13 @@ from django.contrib.auth import get_user_model from rest_framework.authtoken.models import Token from rest_framework import serializers -from applications.gymkhana.models import Club_info,Session_info,Event_info, Voting_choices -from applications.gymkhana.models import Club_member,Core_team,Club_budget,Club_report,Fest_budget,Registration_form,Voting_polls +from applications.gymkhana.models import Club_info,Session_info,Event_info +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments -class Voting_choicesSerializer(serializers.ModelSerializer): - class Meta: - model = Voting_choices - fields = ['poll_event', 'title', 'description', 'votes'] +# class Voting_choicesSerializer(serializers.ModelSerializer): +# class Meta: +# model = Voting_choices +# fields = ['poll_event', 'title', 'description', 'votes'] class Club_infoSerializer(serializers.ModelSerializer): @@ -28,11 +28,11 @@ class Meta: fields = ['member','club','description', 'status','remarks','id'] -class Core_teamSerializer(serializers.ModelSerializer): +# class Core_teamSerializer(serializers.ModelSerializer): - class Meta: - model=Core_team - fields=('all') +# class Meta: +# model=Core_team +# fields=('all') class Club_DetailsSerializer(serializers.ModelSerializer): class Meta: @@ -50,7 +50,7 @@ class event_infoserializer(serializers.ModelSerializer): class Meta: model=Event_info - fields=['club','event_name','incharge','date','venue','start_time','id','details','status'] + fields=['club','event_name','incharge','start_date','end_date','venue','start_time','id','details','status'] class club_budgetserializer(serializers.ModelSerializer): @@ -73,8 +73,12 @@ class Meta: model=Registration_form fields=['roll','user_name','branch','cpi','programme'] -class Voting_pollSerializer(serializers.ModelSerializer): +# class Voting_pollSerializer(serializers.ModelSerializer): +# class Meta: +# model=Voting_polls +# fields=['title','pub_date','exp_date','created_by','groups','id','description'] +class BudgetSerializer(serializers.ModelSerializer): class Meta: - model=Voting_polls - fields=['title','pub_date','exp_date','created_by','groups','id','description'] \ No newline at end of file + model = Budget + fields = ['id', 'club', 'budget_for', 'budget_amt', 'budget_file', 'description', 'status', 'remarks'] \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 0ec4b524e..8c9cf007a 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -11,8 +11,8 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from django.shortcuts import render -from applications.gymkhana.models import Voting_choices, Registration_form, Student ,Club_info,Club_member,Core_team,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Voting_polls -from .serializers import Club_memberSerializer,Core_teamSerializer,Club_DetailsSerializer,Session_infoSerializer, Voting_choicesSerializer,event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer,Voting_pollSerializer, Club_infoSerializer +from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget +from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer from django.contrib.auth.models import User from applications.gymkhana.views import * @@ -21,7 +21,31 @@ import base64 from rest_framework.parsers import MultiPartParser +class Budgetinfo(APIView): + def get(self, request): + budgets = Budget.objects.all() + serializer = BudgetSerializer(budgets, many=True) + return Response(serializer.data) + +class Club_Detail(APIView): + def post(self, request): + club_name = request.data.get('club_name') + if not club_name: + return Response({"error": "club_name is required"}, status=status.HTTP_400_BAD_REQUEST) + clubdetail = get_object_or_404(Club_info, club_name=club_name) + serializer = Club_DetailsSerializer(clubdetail) + return Response(serializer.data, status=status.HTTP_200_OK) +class UpcomingEventsAPIView(APIView): + def get(self, request): + events = Event_info.objects.filter(start_date__gte=datetime.datetime.now()).order_by('start_date') + serializer = event_infoserializer(events, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) +class PastEventsAPIView(APIView): + def get(self, request): + events = Event_info.objects.filter(end_date__lt=datetime.datetime.now()).order_by('end_date') + serializer = event_infoserializer(events, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) class UploadActivityCalendarAPIView(APIView): parser_classes = [MultiPartParser] @@ -44,45 +68,45 @@ def post(self, request, format=None): return Response({'message': 'Activity calendar updated successfully'}, status=status.HTTP_200_OK) -class VoteIncrementAPIView(APIView): - def post(self, request): - serializer = Voting_choicesSerializer(data=request.data, many=True) - if not serializer.is_valid(): - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +# class VoteIncrementAPIView(APIView): +# def post(self, request): +# serializer = Voting_choicesSerializer(data=request.data, many=True) +# if not serializer.is_valid(): +# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - data = serializer.validated_data - for choice_data in data: - poll_event_id = choice_data.get('poll_event') - title = choice_data.get('title') - try: - choice_instance = Voting_choices.objects.get(poll_event_id=poll_event_id, title=title) - choice_instance.votes += 1 - choice_instance.save() - except Voting_choices.DoesNotExist: - pass # Do nothing if the choice with the given poll_event and title doesn't exist +# data = serializer.validated_data +# for choice_data in data: +# poll_event_id = choice_data.get('poll_event') +# title = choice_data.get('title') +# try: +# choice_instance = Voting_choices.objects.get(poll_event_id=poll_event_id, title=title) +# choice_instance.votes += 1 +# choice_instance.save() +# except Voting_choices.DoesNotExist: +# pass # Do nothing if the choice with the given poll_event and title doesn't exist - return Response({'message': 'Votes incremented successfully'}, status=status.HTTP_200_OK) + # return Response({'message': 'Votes incremented successfully'}, status=status.HTTP_200_OK) -class VotingPollsDeleteAPIView(APIView): - def post(self, request): - Voting_poll_id = request.data.get('id') # Assuming the ID is sent in the request body - try: - Voting_poll = Voting_polls.objects.get(id=Voting_poll_id) - except Voting_polls.DoesNotExist: - return Response({"error": "Voting Poll not found."}, status=status.HTTP_404_NOT_FOUND) +# class VotingPollsDeleteAPIView(APIView): +# def post(self, request): +# Voting_poll_id = request.data.get('id') # Assuming the ID is sent in the request body +# try: +# Voting_poll = Voting_polls.objects.get(id=Voting_poll_id) +# except Voting_polls.DoesNotExist: +# return Response({"error": "Voting Poll not found."}, status=status.HTTP_404_NOT_FOUND) - # Delete the club member object - Voting_poll.delete() +# # Delete the club member object +# Voting_poll.delete() - return Response({"message": "POll deleted successfully."}, status=status.HTTP_204_NO_CONTENT) +# return Response({"message": "POll deleted successfully."}, status=status.HTTP_204_NO_CONTENT) -class ShowVotingChoicesAPIView(APIView): - def get(self, request): - voting_choices = Voting_choices.objects.all() - serializer = Voting_choicesSerializer(voting_choices, many=True) - return Response(serializer.data, status=status.HTTP_200_OK) +# class ShowVotingChoicesAPIView(APIView): +# def get(self, request): +# voting_choices = Voting_choices.objects.all() +# serializer = Voting_choicesSerializer(voting_choices, many=True) +# return Response(serializer.data, status=status.HTTP_200_OK) class ClubMemberApproveView(generics.UpdateAPIView): def post(self, request): @@ -281,14 +305,14 @@ def coordinator_club(request): if str(request.user) in [club.co_ordinator, club.co_coordinator]: serialized_club = Club_infoSerializer(club).data club_info.append(serialized_club) - return club_info + return club_info -class core(APIView): - def get(self,request): - co=Core_team.objects.all() - serializer=Core_teamSerializer(co, many=True) - print(serializer.data) - return Response(serializer.data) +# class core(APIView): +# def get(self,request): +# co=Core_team.objects.all() +# serializer=Core_teamSerializer(co, many=True) +# print(serializer.data) +# return Response(serializer.data) class clubname(APIView): permission_classes = [IsAuthenticated] @@ -344,12 +368,12 @@ def get(self,respect): return Response(serializer.data) -class Voting_Polls(APIView): +# class Voting_Polls(APIView): - def get(self,respect): - votingpolls=Voting_polls.objects.all() - serializer=Voting_pollSerializer(votingpolls, many=True) - return Response(serializer.data) +# def get(self,respect): +# votingpolls=Voting_polls.objects.all() +# serializer=Voting_pollSerializer(votingpolls, many=True) +# return Response(serializer.data) ##logger = logging.getLogger(_NamedFuncPointer) class NewSessionAPIView(APIView): @@ -536,28 +560,28 @@ def post(self, request): return JsonResponse({"error": str(e)}, status=500) -class CreateVotingPollAPIView(APIView): - def post(self, request): - voting_poll_serializer = Voting_pollSerializer(data=request.data) - if voting_poll_serializer.is_valid(): - voting_poll_instance = voting_poll_serializer.save() - - # Extract ID of the created Voting_poll instance - voting_poll_id = voting_poll_instance.id - - # Modify the request data to include poll_event ID for each choice - choices_data = request.data.get('choices', []) - for choice_data in choices_data: - choice_data['poll_event'] = voting_poll_id - - voting_choices_serializer = Voting_choicesSerializer(data=choices_data, many=True) - if voting_choices_serializer.is_valid(): - voting_choices_serializer.save() - return Response({'message': 'Voting poll created successfully'}, status=status.HTTP_201_CREATED) - else: - return Response({'voting_choices_errors': voting_choices_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'voting_poll_errors': voting_poll_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) +# class CreateVotingPollAPIView(APIView): +# def post(self, request): +# voting_poll_serializer = Voting_pollSerializer(data=request.data) +# if voting_poll_serializer.is_valid(): +# voting_poll_instance = voting_poll_serializer.save() + +# # Extract ID of the created Voting_poll instance +# voting_poll_id = voting_poll_instance.id + +# # Modify the request data to include poll_event ID for each choice +# choices_data = request.data.get('choices', []) +# for choice_data in choices_data: +# choice_data['poll_event'] = voting_poll_id + +# voting_choices_serializer = Voting_choicesSerializer(data=choices_data, many=True) +# if voting_choices_serializer.is_valid(): +# voting_choices_serializer.save() +# return Response({'message': 'Voting poll created successfully'}, status=status.HTTP_201_CREATED) +# else: +# return Response({'voting_choices_errors': voting_choices_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'voting_poll_errors': voting_poll_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) class UpdateClubBudgetAPIView(APIView): def post(self, request): @@ -817,22 +841,14 @@ def post(self, request): class ApproveEvent(APIView): def post(self, request): - # Retrieve data from request event_data = request.data - - # Extract fields for filtering event_name = event_data.get('event_name') incharge = event_data.get('incharge') date = event_data.get('date') venue = event_data.get('venue') event_id = event_data.get('id') - # status = event_data.get('status') - - # Check if all required fields are provided if not all([event_name, incharge, date, venue, event_id]): return Response({"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST) - - # Try to find the event based on provided fields try: event = Event_info.objects.get( event_name=event_name, @@ -843,9 +859,103 @@ def post(self, request): ) except Event_info.DoesNotExist: return Response({"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND) - - # Update the status of the event event.status = 'confirmed' event.save() + return Response({"message": "event status updated successfully"}, status=status.HTTP_200_OK) + +class AddClubAPI(APIView): + def post(self, request): + serializer = Club_infoSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response({"message": "Club added successfully!"}, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - return Response({"message": "event status updated successfully"}, status=status.HTTP_200_OK) \ No newline at end of file +class NewEventAPIView(APIView): + def put(self, request): + request.data['status'] = 'FIC' + serializer = event_infoserializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +class FICApproveEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + if event.status != 'FIC': + return Response({"error": "Event is not under FIC review."}, status=status.HTTP_400_BAD_REQUEST) + event.status = 'COUNSELLOR' + event.save() + + return Response({"message": "Event status changed to 'Counsellor Review'."}, status=status.HTTP_200_OK) +class CounsellorApproveEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + if event.status != 'COUNSELLOR': + return Response({"error": "Event is not under Counsellor review."}, status=status.HTTP_400_BAD_REQUEST) + event.status = 'DEAN' + event.save() + + return Response({"message": "Event status changed to 'Dean Review'."}, status=status.HTTP_200_OK) +class DeanApproveEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + if event.status != 'DEAN': + return Response({"error": "Event is not under Dean review."}, status=status.HTTP_400_BAD_REQUEST) + event.status = 'ACCEPT' + event.save() + + return Response({"message": "Event status changed to 'Accepted'."}, status=status.HTTP_200_OK) +class NewBudgetAPIView(APIView): + def put(self, request): + request.data['status'] = 'FIC' + serializer = BudgetSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class FICApproveBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + if budget.status != 'FIC': + return Response({"error": "Budget is not under FIC review."}, status=status.HTTP_400_BAD_REQUEST) + budget.status = 'COUNSELLOR' + budget.save() + return Response({"message": "Budget status changed to 'Counsellor Review'."}, status=status.HTTP_200_OK) +class CounsellorApproveBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + if budget.status != 'COUNSELLOR': + return Response({"error": "Budget is not under Counsellor review."}, status=status.HTTP_400_BAD_REQUEST) + budget.status = 'DEAN' + budget.save() + return Response({"message": "Budget status changed to 'Dean Review'."}, status=status.HTTP_200_OK) +class DeanApproveBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + if budget.status != 'DEAN': + return Response({"error": "Budget is not under Dean review."}, status=status.HTTP_400_BAD_REQUEST) + budget.status = 'ACCEPT' + budget.save() + return Response({"message": "Budget status changed to 'Accepted'."}, status=status.HTTP_200_OK) +class RejectBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + budget.status = 'REJECT' + budget.save() + return Response({"message": "Budget status changed to 'Rejected'."}, status=status.HTTP_200_OK) +class RejectEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + event.status = 'REJECT' + event.save() + return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py new file mode 100644 index 000000000..67cd41461 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py @@ -0,0 +1,98 @@ +# Generated by Django 3.1.5 on 2024-10-13 22:51 + +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Budget', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('budget_for', models.CharField(max_length=256)), + ('budget_amt', models.IntegerField(default=0)), + ('budget_file', models.FileField(upload_to='uploads/')), + ('description', models.TextField(max_length=256)), + ('status', models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review')], default='COORDINATOR', max_length=50)), + ('remarks', models.CharField(max_length=256, null=True)), + ('club', models.ForeignKey(max_length=50, on_delete=django.db.models.deletion.CASCADE, to='gymkhana.club_info')), + ], + options={ + 'db_table': 'Budget', + }, + ), + migrations.CreateModel( + name='Budget_Comments', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('commentator_designation', models.CharField(max_length=100)), + ('comment', models.TextField()), + ('comment_date', models.DateField(default=django.utils.timezone.now)), + ('comment_time', models.TimeField(default=django.utils.timezone.now)), + ('budget_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='gymkhana.budget')), + ], + options={ + 'db_table': 'Budget_Comments', + }, + ), + migrations.CreateModel( + name='Event_Comments', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('commentator_designation', models.CharField(max_length=100)), + ('comment', models.TextField()), + ('comment_date', models.DateField(default=django.utils.timezone.now)), + ('comment_time', models.TimeField(default=django.utils.timezone.now)), + ], + options={ + 'db_table': 'Event_Comments', + }, + ), + migrations.RemoveField( + model_name='voting_choices', + name='poll_event', + ), + migrations.RemoveField( + model_name='voting_voters', + name='poll_event', + ), + migrations.RenameField( + model_name='event_info', + old_name='date', + new_name='end_date', + ), + migrations.AddField( + model_name='event_info', + name='start_date', + field=models.DateField(default=None), + ), + migrations.AlterField( + model_name='event_info', + name='status', + field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review')], default='open', max_length=50), + ), + migrations.DeleteModel( + name='Core_team', + ), + migrations.DeleteModel( + name='Voting_choices', + ), + migrations.DeleteModel( + name='Voting_polls', + ), + migrations.DeleteModel( + name='Voting_voters', + ), + migrations.AddField( + model_name='event_comments', + name='Event_id', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='gymkhana.event_info'), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 3544f2f3b..dee95222e 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -28,6 +28,14 @@ class Constants: ("Cultural", "Cultural"), ) status = (("open", "Open"), ("confirmed", "Confirmed"), ("rejected", "Rejected")) + STATUS_CHOICES = ( + ('ACCEPT', 'Accepted'), + ('REJECT', 'Rejected'), + ('COORDINATOR', 'Coordinator Review'), + ('FIC', 'FIC Review'), + ('COUNSELLOR', 'Counsellor Review'), + ('DEAN', 'Dean Review') + ) fest = (("Abhikalpan", "Abhikalpan"), ("Gusto", "Gusto"), ("Tarang", "Tarang")) venue = ( ( @@ -180,36 +188,37 @@ class Meta: db_table = "Club_member" -class Core_team(models.Model): - """ - The details about the main members who conducted/take care of the fest. - It stores the indormation of those members. +# class Core_team(models.Model): +# """ +# The details about the main members who conducted/take care of the fest. +# It stores the indormation of those members. - id - serial number - student_id - roll number of student - team - name of the core_team - year - year in which this team conducted the fest - fest_name - name of the fest the core_team students takes care of - pda - achievements they achieved through the fest - remarks - remarks(if there are any) in the fest +# id - serial number +# student_id - roll number of student +# team - name of the core_team +# year - year in which this team conducted the fest +# fest_name - name of the fest the core_team students takes care of +# pda - achievements they achieved through the fest +# remarks - remarks(if there are any) in the fest - """ +# """ - id = models.AutoField(primary_key=True) - student_id = models.ForeignKey( - Student, on_delete=models.CASCADE, related_name="applied_for" - ) - team = models.CharField(max_length=50, null=False) - year = models.DateTimeField(max_length=6, null=True) - fest_name = models.CharField(max_length=256, null=False, choices=Constants.fest) - pda = models.TextField(max_length=256, null=False) - remarks = models.CharField(max_length=256, null=True) +# id = models.AutoField(primary_key=True) +# student_id = models.ForeignKey( +# Student, on_delete=models.CASCADE, related_name="applied_for" +# ) +# team = models.CharField(max_length=50, null=False) +# year = models.DateTimeField(max_length=6, null=True) +# fest_name = models.CharField(max_length=256, null=False, choices=Constants.fest) +# pda = models.TextField(max_length=256, null=False) +# remarks = models.CharField(max_length=256, null=True) - def __str__(self): - return str(self.student_id) +# def __str__(self): +# return str(self.student_id) + +# class Meta: +# db_table = "Core_team" - class Meta: - db_table = "Core_team" class Club_budget(models.Model): @@ -284,7 +293,8 @@ class Event_info(models.Model): event_name - name of the event venue - the place at which they conducting the event incharge - name of faculty who is incharge for the event - date - date of the event + start_date - start date of the event + end_date - end date of event start_time - the time at which event starts end_time - the time at which event ends event_poster - the logo/poster for the event(image) @@ -300,13 +310,14 @@ class Event_info(models.Model): event_name = models.CharField(max_length=256, null=False) venue = models.CharField(max_length=50, null=False, choices=Constants.venue) incharge = models.CharField(max_length=256, null=False) - date = models.DateField(default=None, auto_now=False, null=False) + end_date = models.DateField(default=None, auto_now=False, null=False) + start_date=models.DateField(default=None, auto_now=False, null=False) start_time = models.TimeField(default=None, auto_now=False, null=False) end_time = models.TimeField(default=None, auto_now=False, null=True) event_poster = models.FileField(upload_to="gymkhana/event_poster", blank=True) details = models.TextField(max_length=256, null=True) - status = models.CharField(max_length=50, choices=Constants.status, default="open") - + status = models.CharField(max_length=50, choices=Constants.STATUS_CHOICES, default="open") + #change the status choices def __str__(self): return str(self.id) @@ -445,71 +456,71 @@ class Meta: db_table = "Change_office" -class Voting_polls(models.Model): - """ - It shows the information about the voting poll. +# class Voting_polls(models.Model): +# """ +# It shows the information about the voting poll. - title - title of the poll - description - explanation about the voting - pub_date - the date at which polling starts - exp_date - the date at which polling ends - created_by - name of the person who created this poll - groups - the groups that are participating in the voting +# title - title of the poll +# description - explanation about the voting +# pub_date - the date at which polling starts +# exp_date - the date at which polling ends +# created_by - name of the person who created this poll +# groups - the groups that are participating in the voting - """ +# """ - title = models.CharField(max_length=200, null=False) - description = models.CharField(max_length=5000, null=False) - pub_date = models.DateTimeField(default=timezone.now) - exp_date = models.DateTimeField(default=timezone.now) - created_by = models.CharField(max_length=100, null=True) - groups = models.CharField(max_length=500, default="{}") +# title = models.CharField(max_length=200, null=False) +# description = models.CharField(max_length=5000, null=False) +# pub_date = models.DateTimeField(default=timezone.now) +# exp_date = models.DateTimeField(default=timezone.now) +# created_by = models.CharField(max_length=100, null=True) +# groups = models.CharField(max_length=500, default="{}") - def groups_data(self): - return self.groups +# def groups_data(self): +# return self.groups - def __str__(self): - return self.title +# def __str__(self): +# return self.title - class Meta: - ordering = ["-pub_date"] +# class Meta: +# ordering = ["-pub_date"] -class Voting_choices(models.Model): - """ - poll_event - name of the poll_event - title - name of the poll - description - description about choices if any - votes - no.of votes recorded +# class Voting_choices(models.Model): +# """ +# poll_event - name of the poll_event +# title - name of the poll +# description - description about choices if any +# votes - no.of votes recorded - """ +# """ - poll_event = models.ForeignKey(Voting_polls, on_delete=models.CASCADE) - title = models.CharField(max_length=200, null=False) - description = models.CharField(max_length=500, default="") - votes = models.IntegerField(default=0) +# poll_event = models.ForeignKey(Voting_polls, on_delete=models.CASCADE) +# title = models.CharField(max_length=200, null=False) +# description = models.CharField(max_length=500, default="") +# votes = models.IntegerField(default=0) - def __str__(self): - return self.title +# def __str__(self): +# return self.title - class Meta: - get_latest_by = "votes" +# class Meta: +# get_latest_by = "votes" -class Voting_voters(models.Model): - """ - records students who has voted in the poll. +# class Voting_voters(models.Model): +# """ +# records students who has voted in the poll. - poll_event - name of the poll - student_id - roll number of student +# poll_event - name of the poll +# student_id - roll number of student - """ +# """ - poll_event = models.ForeignKey(Voting_polls, on_delete=models.CASCADE) - student_id = models.CharField(max_length=50, null=False) +# poll_event = models.ForeignKey(Voting_polls, on_delete=models.CASCADE) +# student_id = models.CharField(max_length=50, null=False) - def __str__(self): - return self.student_id +# def __str__(self): +# return self.student_id class Inventory(models.Model): @@ -526,4 +537,67 @@ def __str__(self): return str(self.club_name) class Meta: - db_table = "Inventory" \ No newline at end of file + db_table = "Inventory" +class Budget(models.Model): + id = models.AutoField(primary_key=True) + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, max_length=50, null=False + ) + budget_for = models.CharField(max_length=256, null=False) + budget_amt = models.IntegerField(default=0, null=False) + budget_file = models.FileField(upload_to="uploads/", null=True) + description = models.TextField(max_length=256, null=False) + status = models.CharField(max_length=50, choices=Constants.STATUS_CHOICES, default="COORDINATOR") + remarks = models.CharField(max_length=256, null=True) + + def __str__(self): + return str(self.id) + + class Meta: + db_table = "Budget" +class Budget_Comments(models.Model): + """ + This table stores the comments related to budgets. + + Fields: + - budget_id: ForeignKey to the related budget entry + - commentator_designation: Designation of the person commenting + - comment: The content of the comment + - comment_date: The date the comment was made + - comment_time: The time the comment was made + """ + + budget_id = models.ForeignKey('Budget', on_delete=models.CASCADE, related_name='comments') + commentator_designation = models.CharField(max_length=100, null=False) + comment = models.TextField(null=False) # The actual comment + comment_date = models.DateField(default=timezone.now, null=False) # Date of the comment + comment_time = models.TimeField(default=timezone.now, null=False) # Time of the comment + + def __str__(self): + return f"Comment by {self.commentator_designation} on {self.comment_date}" + + class Meta: + db_table = "Budget_Comments" +class Event_Comments(models.Model): + """ + This table stores the comments related to budgets. + + Fields: + - Event_id: ForeignKey to the related budget entry + - commentator_designation: Designation of the person commenting + - comment: The content of the comment + - comment_date: The date the comment was made + - comment_time: The time the comment was made + """ + + Event_id = models.ForeignKey('Event_info', on_delete=models.CASCADE, related_name='comments') + commentator_designation = models.CharField(max_length=100, null=False) + comment = models.TextField(null=False) # The actual comment + comment_date = models.DateField(default=timezone.now, null=False) # Date of the comment + comment_time = models.TimeField(default=timezone.now, null=False) # Time of the comment + + def __str__(self): + return f"Comment by {self.commentator_designation} on {self.comment_date}" + + class Meta: + db_table = "Event_Comments" \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 3c8c20de1..83bec86be 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -4,13 +4,18 @@ from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form from applications.gymkhana.api.views import session_details -from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView, ShowVotingChoicesAPIView, VoteIncrementAPIView, VotingPollsDeleteAPIView +from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView from . import views from rest_framework.authtoken.views import obtain_auth_token app_name = 'gymkhana' urlpatterns = [ + #for club_detail,upcomingevents and past events + url(r"^club_detail/$", Club_Detail.as_view()), + url(r"^upcoming_events/$", UpcomingEventsAPIView.as_view()), + url(r"^past_events/$", PastEventsAPIView.as_view()), + url(r"^budget/$", Budgetinfo.as_view()), url(r"^session_details/$", session_details.as_view()), url(r"^event_info/$", club_events.as_view()), url(r"^club_budgetinfo/$", club_budgetinfo.as_view()), @@ -85,10 +90,10 @@ views.studentsClubMembers, name="students_data"), url(r"^get_venue/$", views.getVenue, name="get_venue"), # core_team - url(r"^core_team/$", views.core_team, name="core_team"), + # url(r"^core_team/$", views.core_team, name="core_team"), url(r"^festbudget/$", views.fest_budget, name="fest_budget"), # fic - url(r"^Inventory_update/$", views.core_team, name="Inventory_update"), + # url(r"^Inventory_update/$", views.core_team, name="Inventory_update"), url(r"^del_club/$", views.del_club, name="del_club"), url(r"^approve_events/$", views.approve_events, name="approve_events"), url(r"^update-club-name/$", views.update_club_name, name='update-club-name'), @@ -112,9 +117,9 @@ url(r'^api/member_approve/$', ClubMemberApproveView.as_view(), name='approval'), url(r'^api/member_reject/$', ClubMemberDeleteAPIView.as_view(), name='reject'), url(r'^api/club_membership/$', AddMemberToClub.as_view(), name='new_club_member'), - url(r'^api/show_voting_choices/$', ShowVotingChoicesAPIView.as_view(), name='voting_choices'), - url(r'^api/delete_poll/$', VotingPollsDeleteAPIView.as_view(), name='delete poll'), - url(r'^api/vote/$', VoteIncrementAPIView.as_view(), name='give vote'), + # url(r'^api/show_voting_choices/$', ShowVotingChoicesAPIView.as_view(), name='voting_choices'), + # url(r'^api/delete_poll/$', VotingPollsDeleteAPIView.as_view(), name='delete poll'), + # url(r'^api/vote/$', VoteIncrementAPIView.as_view(), name='give vote'), url(r'^api/edit_session/$', SessionUpdateAPIView.as_view(), name='edit session'), url(r'^api/edit_event/$', EventUpdateAPIView.as_view(), name='edit event'), url(r'^api/delete_budget/$',DeleteClubBudgetAPIView.as_view(), name='delete budget'), @@ -123,5 +128,23 @@ url(r'^api/update_clubStatus/$', UpdateClubStatusAPIView.as_view(),name = 'update club status' ), url(r'^api/updateClubName/$', UpdateClubNameAPIView.as_view(), name = 'update club name'), url(r'^api/approve_event/$', ApproveEvent.as_view(), name = 'approve event'), + #add club api + url(r'^api/add_club/$', AddClubAPI.as_view(), name='add club'), + #new budget api + url(r'^api/new_budget/$', NewBudgetAPIView.as_view(), name='new budget'), + #fic approve budget api + url(r'^api/fic_approve_budget/$', FICApproveBudgetAPIView.as_view(), name='fic approve budget'), + #counsellor approve budget api + url(r'^api/counsellor_approve_budget/$', CounsellorApproveBudgetAPIView.as_view(), name='counsellor approve budget'), + #dean approve budget api + url(r'^api/dean_approve_budget/$', DeanApproveBudgetAPIView.as_view(), name='dean approve budget'), + #new event api + url(r'^api/new_events/$', NewEventAPIView.as_view(), name='new events'), + #fic approve event api + url(r'^api/fic_approve_event/$', FICApproveEventAPIView.as_view(), name='fic approve event'), + #counsellor approve event api + url(r'^api/counsellor_approve_event/$', CounsellorApproveEventAPIView.as_view(), name='counsellor approve event'), + #dean approve event api + url(r'^api/dean_approve_event/$', DeanApproveEventAPIView.as_view(), name='dean approve event') ] diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 393d26986..e694fb742 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1169,45 +1169,45 @@ def club_membership(request): # return redirect('/gymkhana/') -@login_required -def core_team(request): - """ - core_team: - This view takes the data of students. Data like, their name, fest name, team, pda and - year. And finally saving this data to the database of the core team. - This will done only when the method is POST and at the end it will redirect to '/gymkhana/' - @params: - request : trivial - @variables: - user : Name of the user - fest : Name of the fest - team : Name of the team - achievements : Achievements of the user - year : Acedamic year of the core team - - """ - if request.method == "POST": - # getting form data - user = request.POST.get("user_name") - fest = request.POST.get("fest") - team = request.POST.get("team") - achievements = request.POST.get("pda") - year = request.POST.get("year") - - # getting queryset class objects - USER = user.split(" - ") - user_name = get_object_or_404(User, username=USER[1]) - extra = get_object_or_404(ExtraInfo, id=USER[00], user=user_name) - student = get_object_or_404(Student, id=extra) +# @login_required +# def core_team(request): +# """ +# core_team: +# This view takes the data of students. Data like, their name, fest name, team, pda and +# year. And finally saving this data to the database of the core team. +# This will done only when the method is POST and at the end it will redirect to '/gymkhana/' +# @params: +# request : trivial +# @variables: +# user : Name of the user +# fest : Name of the fest +# team : Name of the team +# achievements : Achievements of the user +# year : Acedamic year of the core team - # saving data to the database - core_team = Core_team( - student_id=student, fest_name=fest, team=team, pda=achievements, year=year - ) - core_team.save() - messages.success(request, "Successfully applied for the post !!!") +# """ +# if request.method == "POST": +# # getting form data +# user = request.POST.get("user_name") +# fest = request.POST.get("fest") +# team = request.POST.get("team") +# achievements = request.POST.get("pda") +# year = request.POST.get("year") + +# # getting queryset class objects +# USER = user.split(" - ") +# user_name = get_object_or_404(User, username=USER[1]) +# extra = get_object_or_404(ExtraInfo, id=USER[00], user=user_name) +# student = get_object_or_404(Student, id=extra) + +# # saving data to the database +# core_team = Core_team( +# student_id=student, fest_name=fest, team=team, pda=achievements, year=year +# ) +# core_team.save() +# messages.success(request, "Successfully applied for the post !!!") - return redirect("/gymkhana/") +# return redirect("/gymkhana/") @login_required From 186ac3121a5750680f0a3d7f8eb33da6b7fc88a8 Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Thu, 17 Oct 2024 15:59:34 +0530 Subject: [PATCH 02/11] feat(gymkhana): Added Acheivement Tables and Corresponding APIs --- .../applications/gymkhana/api/serializers.py | 8 ++- FusionIIIT/applications/gymkhana/api/views.py | 50 ++++++++++++------- .../migrations/0003_auto_20241016_0911.py | 48 ++++++++++++++++++ .../gymkhana/migrations/0004_achievements.py | 25 ++++++++++ FusionIIIT/applications/gymkhana/models.py | 14 +++++- FusionIIIT/applications/gymkhana/urls.py | 7 +-- 6 files changed, 128 insertions(+), 24 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0004_achievements.py diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index afbb91223..517412f6a 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -3,7 +3,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from applications.gymkhana.models import Club_info,Session_info,Event_info -from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements # class Voting_choicesSerializer(serializers.ModelSerializer): # class Meta: @@ -81,4 +81,8 @@ class Meta: class BudgetSerializer(serializers.ModelSerializer): class Meta: model = Budget - fields = ['id', 'club', 'budget_for', 'budget_amt', 'budget_file', 'description', 'status', 'remarks'] \ No newline at end of file + fields = ['id', 'club', 'budget_for', 'budget_amt', 'budget_file', 'description', 'status', 'remarks'] +class AchievementsSerializer(serializers.ModelSerializer): + class Meta: + model = Achievements + fields = ['id', 'club_name', 'title', 'achievement'] \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 8c9cf007a..91c047202 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -11,8 +11,8 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from django.shortcuts import render -from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget -from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer +from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Achievements +from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer from django.contrib.auth.models import User from applications.gymkhana.views import * @@ -233,27 +233,27 @@ def post(self, request): club_info.save() return JsonResponse({'status': "success", 'message': message}) + class AddMemberToClub(APIView): def post(self, request): - serializer = Club_memberSerializer(data=request.data) + data = { + 'member': request.data.get('member'), + 'club': request.data.get('club'), + 'description': request.data.get('description'), + 'status': 'open' + } + serializer = Club_memberSerializer(data=data) if serializer.is_valid(): - club_id = request.data.get('club') # Assuming 'club_id' is passed in the request data - try: - club_member = serializer.save() - # Implement logic to add member to the club here - # For example, you can retrieve the club instance and add the member to it - # club = Club.objects.get(pk=club_id) - # club.members.add(club_member) - return Response(serializer.data, status=status.HTTP_201_CREATED) - except Exception as e: - return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST) + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class ClubMemberAPIView(APIView): - def get(self, request): - club_members = Club_member.objects.all() + def post(self, request): + club_member_id = request.data.get('club_name') + club_members = Club_member.objects.filter(club_id=club_member_id) serializer = Club_memberSerializer(club_members, many=True) - return Response(serializer.data) + return Response(serializer.data,status=status.HTTP_200_OK) class RegistrationFormAPIView(APIView): """ @@ -958,4 +958,20 @@ def put(self, request): event = get_object_or_404(Event_info, id=event_id) event.status = 'REJECT' event.save() - return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) \ No newline at end of file + return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) +class AchievementsAPIView(APIView): + def post(self, request): + club_name = request.data.get('club_name') + achievements = Achievements.objects.filter(club_name=club_name) + if not achievements.exists(): + return Response({"message": "No achievements found for this club."}, status=404) + + serializer = AchievementsSerializer(achievements, many=True) + return Response(serializer.data, status=200) +class AddAchievementAPIView(APIView): + def post(self, request): + serializer = AchievementsSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py b/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py new file mode 100644 index 000000000..7d53d8e10 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py @@ -0,0 +1,48 @@ +# Generated by Django 3.1.5 on 2024-10-16 09:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0002_auto_20241013_2251'), + ] + + operations = [ + migrations.AlterField( + model_name='budget', + name='budget_file', + field=models.FileField(null=True, upload_to='uploads/'), + ), + migrations.AlterField( + model_name='change_office', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='club_budget', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='club_info', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='club_member', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='fest_budget', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='session_info', + name='status', + field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py b/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py new file mode 100644 index 000000000..1b5768796 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py @@ -0,0 +1,25 @@ +# Generated by Django 3.1.5 on 2024-10-16 21:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0003_auto_20241016_0911'), + ] + + operations = [ + migrations.CreateModel( + name='Achievements', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('club_name', models.CharField(max_length=100)), + ('title', models.CharField(max_length=100)), + ('achievement', models.TextField()), + ], + options={ + 'db_table': 'Achievements', + }, + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index dee95222e..5d86feaf4 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -27,7 +27,7 @@ class Constants: ("Sports", "Sports"), ("Cultural", "Cultural"), ) - status = (("open", "Open"), ("confirmed", "Confirmed"), ("rejected", "Rejected")) + status = (("open", "Open"), ("confirmed", "Confirmed"), ("rejected", "Rejected") ,("member", "Member"),("co-ordinator", "Co-ordinator"),("Co-cordinator", "Co-cordinator")) STATUS_CHOICES = ( ('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), @@ -600,4 +600,14 @@ def __str__(self): return f"Comment by {self.commentator_designation} on {self.comment_date}" class Meta: - db_table = "Event_Comments" \ No newline at end of file + db_table = "Event_Comments" +class Achievements(models.Model): + id = models.AutoField(primary_key=True) + club_name = models.CharField(max_length=100, null=False) + title = models.CharField(max_length=100, null=False) + achievement = models.TextField(null=False) + def _str_(self): + return f"{self.club_name} - {self.achievement}" + + class Meta: + db_table = "Achievements" \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 83bec86be..a083fcde0 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -4,7 +4,7 @@ from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form from applications.gymkhana.api.views import session_details -from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView +from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView from . import views from rest_framework.authtoken.views import obtain_auth_token @@ -145,6 +145,7 @@ #counsellor approve event api url(r'^api/counsellor_approve_event/$', CounsellorApproveEventAPIView.as_view(), name='counsellor approve event'), #dean approve event api - url(r'^api/dean_approve_event/$', DeanApproveEventAPIView.as_view(), name='dean approve event') - + url(r'^api/dean_approve_event/$', DeanApproveEventAPIView.as_view(), name='dean approve event'), + url(r'^api/add_achievement/$', AddAchievementAPIView.as_view(), name = 'approve event'), + url(r'^api/show_achievement/$', AchievementsAPIView.as_view(), name = 'approve event') ] From 2758ef90fd175dda7651aa0b9f17a58beea31f41 Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Fri, 18 Oct 2024 12:18:30 +0530 Subject: [PATCH 03/11] feat(feature&chore): API & Integration Co-authored-by: Avinash0504a ankemavinashchiru@gmail.com Co-authored-by: Blanca-Vern-2nd Lucky615b@gmail.com --- .../applications/gymkhana/api/serializers.py | 10 ++- FusionIIIT/applications/gymkhana/api/views.py | 79 +++++++++++++++++-- .../migrations/0005_auto_20241017_2131.py | 18 +++++ FusionIIIT/applications/gymkhana/models.py | 2 +- FusionIIIT/applications/gymkhana/urls.py | 14 +++- 5 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 517412f6a..ef175d2fa 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -85,4 +85,12 @@ class Meta: class AchievementsSerializer(serializers.ModelSerializer): class Meta: model = Achievements - fields = ['id', 'club_name', 'title', 'achievement'] \ No newline at end of file + fields = ['id', 'club_name', 'title', 'achievement'] +class Budget_CommentsSerializer(serializers.ModelSerializer): + class Meta: + model = Budget_Comments + fields = ['budget_id', 'commentator_designation', 'comment', 'comment_date', 'comment_time'] +class Event_CommentsSerializer(serializers.ModelSerializer): + class Meta: + model = Event_Comments + fields = ['event_id', 'commentator_designation', 'comment', 'comment_date', 'comment_time'] \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 91c047202..d1fdfd743 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -12,7 +12,7 @@ from rest_framework.response import Response from django.shortcuts import render from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Achievements -from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer +from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer,Event_CommentsSerializer,Budget_CommentsSerializer from django.contrib.auth.models import User from applications.gymkhana.views import * @@ -117,7 +117,7 @@ def post(self, request): return Response({"error": "Club member not found."}, status=status.HTTP_404_NOT_FOUND) # Update the status of the club member - club_member.status = 'confirmed' # Assuming 'confirmed' is the status for approval + club_member.status = 'member' # Assuming 'member' is the status for approval club_member.save() return Response({"message": "Status updated successfully."}, status=status.HTTP_200_OK) @@ -233,7 +233,6 @@ def post(self, request): club_info.save() return JsonResponse({'status': "success", 'message': message}) - class AddMemberToClub(APIView): def post(self, request): data = { @@ -876,7 +875,7 @@ def put(self, request): request.data['status'] = 'FIC' serializer = event_infoserializer(data=request.data) if serializer.is_valid(): - serializer.save() + serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @@ -974,4 +973,74 @@ def post(self, request): if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class CreateBudgetCommentAPIView(APIView): + def post(self, request): + data = request.data.copy() + data['comment_date'] = timezone.now().date() + data['comment_time'] = timezone.now().time() + + serializer = Budget_CommentsSerializer(data=data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +class CreateEventCommentAPIView(APIView): + def post(self, request): + data = request.data.copy() + data['comment_date'] = timezone.now().date() + data['comment_time'] = timezone.now().time() + + serializer = Event_CommentsSerializer(data=data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class ListBudgetCommentsAPIView(APIView): + def post(self, request): + budget_id = request.data.get('budget_id') + if not budget_id: + return Response({"error": "Budget ID is required."}, status=status.HTTP_400_BAD_REQUEST) + + comments = Budget_Comments.objects.filter(budget_id=budget_id).order_by('comment_date', 'comment_time') + serializer = Budget_CommentsSerializer(comments, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) +class ListEventCommentsAPIView(APIView): + def post(self, request): + event_id = request.data.get('event_id') + if not event_id: + return Response({"error": "Event ID is required."}, status=status.HTTP_400_BAD_REQUEST) + + comments = Event_Comments.objects.filter(event_id=event_id).order_by('comment_date', 'comment_time') + serializer = Event_CommentsSerializer(comments, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) +class RejectEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + event.status = 'REJECT' + event.save() + return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) +class ModifyEventAPIView(APIView): + def put(self, request): + event_id = request.data.get('id') + event = get_object_or_404(Event_info, id=event_id) + event.status = 'COORDINATOR' + event.save() + return Response({"message": "Event status changed to 'Coordinator review'."}, status=status.HTTP_200_OK) +class ModifyBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + budget.status = 'COORDINATOR' + budget.save() + return Response({"message": "Budget status changed to 'Coordinator Review'."}, status=status.HTTP_200_OK) + +class RejectMemberAPIView(APIView): + def put(self, request): + member_id = request.data.get('id') + member = get_object_or_404(Club_member, id=member_id) + member.status = 'rejected' + member.save() + return Response({"message": "Member status changed to 'rejected'."}, status=status.HTTP_200_OK) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py b/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py new file mode 100644 index 000000000..5c6910f57 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-10-17 21:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0004_achievements'), + ] + + operations = [ + migrations.RenameField( + model_name='event_comments', + old_name='Event_id', + new_name='event_id', + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 5d86feaf4..052e49f54 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -590,7 +590,7 @@ class Event_Comments(models.Model): - comment_time: The time the comment was made """ - Event_id = models.ForeignKey('Event_info', on_delete=models.CASCADE, related_name='comments') + event_id = models.ForeignKey('Event_info', on_delete=models.CASCADE, related_name='comments') commentator_designation = models.CharField(max_length=100, null=False) comment = models.TextField(null=False) # The actual comment comment_date = models.DateField(default=timezone.now, null=False) # Date of the comment diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index a083fcde0..814486cf0 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -1,10 +1,10 @@ from django.conf.urls import url from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns -from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView +from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView,ModifyEventAPIView,ModifyBudgetAPIView,RejectEventAPIView,RejectBudgetAPIView from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form from applications.gymkhana.api.views import session_details -from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView +from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView,CreateBudgetCommentAPIView,CreateEventCommentAPIView,ListBudgetCommentsAPIView,ListEventCommentsAPIView from . import views from rest_framework.authtoken.views import obtain_auth_token @@ -147,5 +147,13 @@ #dean approve event api url(r'^api/dean_approve_event/$', DeanApproveEventAPIView.as_view(), name='dean approve event'), url(r'^api/add_achievement/$', AddAchievementAPIView.as_view(), name = 'approve event'), - url(r'^api/show_achievement/$', AchievementsAPIView.as_view(), name = 'approve event') + url(r'^api/show_achievement/$', AchievementsAPIView.as_view(), name = 'approve event'), + url(r'^api/create_budget_comment/$', CreateBudgetCommentAPIView.as_view(), name='create budget comment'), + url(r'^api/create_event_comment/$', CreateEventCommentAPIView.as_view(), name='create event comment'), + url(r'^api/list_budget_comments/$', ListBudgetCommentsAPIView.as_view(),name='list budget comments'), + url(r'^api/list_event_comments/$', ListEventCommentsAPIView.as_view(), name='list event comments'), + url(r'^api/modify_event/$', ModifyEventAPIView.as_view(), name='modify event'), + url(r'^api/modify_budget/$', ModifyBudgetAPIView.as_view(), name='modify budget'), + url(r'^api/reject_event/$', RejectEventAPIView.as_view(), name='reject event'), + url(r'^api/reject_budget/$', RejectBudgetAPIView.as_view(), name='reject budget'), ] From a93246cf032333cdd26c5a442992ed12ff6f6828 Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Wed, 30 Oct 2024 14:02:09 +0530 Subject: [PATCH 04/11] feat(feature): Added functionality for Coordinator View & Budget Approvals & Migration for club_position --- .../applications/gymkhana/api/serializers.py | 10 +++-- FusionIIIT/applications/gymkhana/api/views.py | 44 +++++++++++++++++-- .../gymkhana/migrations/0006_clubposition.py | 26 +++++++++++ FusionIIIT/applications/gymkhana/models.py | 19 +++++++- FusionIIIT/applications/gymkhana/urls.py | 8 +++- 5 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index ef175d2fa..4504a833f 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -3,7 +3,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from applications.gymkhana.models import Club_info,Session_info,Event_info -from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition # class Voting_choicesSerializer(serializers.ModelSerializer): # class Meta: @@ -50,7 +50,7 @@ class event_infoserializer(serializers.ModelSerializer): class Meta: model=Event_info - fields=['club','event_name','incharge','start_date','end_date','venue','start_time','id','details','status'] + fields=['club','event_name','incharge','start_date','end_date','venue','start_time','id','details','status','end_time','details'] class club_budgetserializer(serializers.ModelSerializer): @@ -93,4 +93,8 @@ class Meta: class Event_CommentsSerializer(serializers.ModelSerializer): class Meta: model = Event_Comments - fields = ['event_id', 'commentator_designation', 'comment', 'comment_date', 'comment_time'] \ No newline at end of file + fields = ['event_id', 'commentator_designation', 'comment', 'comment_date', 'comment_time'] +class ClubPositionSerializer(serializers.ModelSerializer): + class Meta: + model = ClubPosition + fields = ['id', 'name', 'position', 'club'] \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index d1fdfd743..0b9086fe1 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -11,8 +11,8 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from django.shortcuts import render -from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Achievements -from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer,Event_CommentsSerializer,Budget_CommentsSerializer +from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Achievements,ClubPosition +from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer,Event_CommentsSerializer,Budget_CommentsSerializer,ClubPositionSerializer from django.contrib.auth.models import User from applications.gymkhana.views import * @@ -1043,4 +1043,42 @@ def put(self, request): member = get_object_or_404(Club_member, id=member_id) member.status = 'rejected' member.save() - return Response({"message": "Member status changed to 'rejected'."}, status=status.HTTP_200_OK) \ No newline at end of file + return Response({"message": "Member status changed to 'rejected'."}, status=status.HTTP_200_OK) +class AddClubPositionAPIView(APIView): + def post(self, request): + serializer = ClubPositionSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class ListClubPositionAPIView(APIView): + def post(self, request): + name=request.data.get('name') + positions = ClubPosition.objects.filter(name=name) + serializer = ClubPositionSerializer(positions, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) +class UpdateEventAPIView(APIView): + def put(self, request): + try: + # Fetch the event to be updated + pk = request.data.get('id') + event = Event_info.objects.get(pk=pk) + except Event_info.DoesNotExist: + return Response({"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND) + + # Partial update for 'details' and 'event_poster' + data = {} + if 'details' in request.data: + data['details'] = request.data['details'] + if 'event_poster' in request.FILES: + data['event_poster'] = request.FILES['event_poster'] + data['status'] = 'FIC' + + # Create serializer instance with partial=True to allow partial updates + serializer = event_infoserializer(event, data=data, partial=True) + + # Validate and update + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py b/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py new file mode 100644 index 000000000..b5036189f --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.5 on 2024-10-22 21:31 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0005_auto_20241017_2131'), + ] + + operations = [ + migrations.CreateModel( + name='ClubPosition', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('position', models.CharField(choices=[('FIC', 'FIC'), ('COORDINATOR', 'Coordinator'), ('TECHNICAL_COUNSELLOR', 'Technical counsellor'), ('SPORTS_COUNSELLOR', 'Sports counsellor'), ('CULTURAL_COUNSELLOR', 'Cultural counsellor')], max_length=50)), + ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.club_info')), + ], + options={ + 'db_table': 'ClubPosition', + }, + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 052e49f54..522e12525 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -610,4 +610,21 @@ def _str_(self): return f"{self.club_name} - {self.achievement}" class Meta: - db_table = "Achievements" \ No newline at end of file + db_table = "Achievements" +class ClubPosition(models.Model): + POSITION_CHOICES = [ + ('FIC', 'FIC'), + ('COORDINATOR', 'Coordinator'), + ('TECHNICAL_COUNSELLOR','Technical counsellor'), + ('SPORTS_COUNSELLOR','Sports counsellor'), + ('CULTURAL_COUNSELLOR','Cultural counsellor') + ] + name = models.CharField(max_length=100, null=False) + position = models.CharField(max_length=50, choices=POSITION_CHOICES, null=False) + club = models.ForeignKey(Club_info, on_delete=models.CASCADE) + class Meta: + db_table = 'ClubPosition' + def _str_(self): + return f"{self.club.club_name} - {self.name} - {self.position}" + class Meta: + db_table = "ClubPosition" \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 814486cf0..3a1d2fd7b 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -1,10 +1,10 @@ from django.conf.urls import url from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns -from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView,ModifyEventAPIView,ModifyBudgetAPIView,RejectEventAPIView,RejectBudgetAPIView +from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView,ModifyEventAPIView,ModifyBudgetAPIView,RejectEventAPIView,RejectBudgetAPIView,UpdateEventAPIView from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form from applications.gymkhana.api.views import session_details -from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView,CreateBudgetCommentAPIView,CreateEventCommentAPIView,ListBudgetCommentsAPIView,ListEventCommentsAPIView +from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView,CreateBudgetCommentAPIView,CreateEventCommentAPIView,ListBudgetCommentsAPIView,ListEventCommentsAPIView,AddClubPositionAPIView,ListClubPositionAPIView from . import views from rest_framework.authtoken.views import obtain_auth_token @@ -156,4 +156,8 @@ url(r'^api/modify_budget/$', ModifyBudgetAPIView.as_view(), name='modify budget'), url(r'^api/reject_event/$', RejectEventAPIView.as_view(), name='reject event'), url(r'^api/reject_budget/$', RejectBudgetAPIView.as_view(), name='reject budget'), + url(r'^api/add_club_position/$', AddClubPositionAPIView.as_view(), name='add club position'), + url(r'^api/list_club_position/$', ListClubPositionAPIView.as_view(), name='list club position'), + url(r'^/api/new_event/$', UpdateEventAPIView.as_view(), name='update event'), + url(r'^api/update_event/$', UpdateEventAPIView.as_view(), name='update event'), ] From 918ada7f6e21216376f2046abe5bbf70482eb691 Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Mon, 3 Mar 2025 16:21:28 +0530 Subject: [PATCH 05/11] fests table backend --- .../migrations/0002_auto_20250210_1657.py | 38 + .../eis/migrations/0002_auto_20250210_1657.py | 53 ++ FusionIIIT/applications/gymkhana/admin.py | 5 +- .../applications/gymkhana/api/serializers.py | 13 +- FusionIIIT/applications/gymkhana/api/views.py | 852 ++++++++++++------ .../gymkhana/migrations/0007_fest.py | 27 + .../migrations/0008_auto_20250217_1709.py | 18 + FusionIIIT/applications/gymkhana/models.py | 12 + FusionIIIT/applications/gymkhana/urls.py | 235 +++-- FusionIIIT/applications/gymkhana/views.py | 212 +++-- .../migrations/0002_auto_20250210_1657.py | 23 + .../migrations/0002_auto_20250210_1657.py | 18 + 12 files changed, 1098 insertions(+), 408 deletions(-) create mode 100644 FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py create mode 100644 FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0007_fest.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py create mode 100644 FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py create mode 100644 FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py diff --git a/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py new file mode 100644 index 000000000..222f0ac60 --- /dev/null +++ b/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.5 on 2025-02-10 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_procedures', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='assistantshipclaim', + name='year', + field=models.IntegerField(choices=[(2025, 2025), (2024, 2024)]), + ), + migrations.AlterField( + model_name='course_registration', + name='working_year', + field=models.IntegerField(blank=True, choices=[(2025, 2025), (2024, 2024)], null=True), + ), + migrations.AlterField( + model_name='finalregistrations', + name='batch', + field=models.IntegerField(default=2025), + ), + migrations.AlterField( + model_name='messdue', + name='year', + field=models.IntegerField(choices=[(2025, 2025), (2024, 2024)]), + ), + migrations.AlterField( + model_name='register', + name='year', + field=models.IntegerField(default=2025), + ), + ] diff --git a/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py new file mode 100644 index 000000000..e36e751be --- /dev/null +++ b/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py @@ -0,0 +1,53 @@ +# Generated by Django 3.1.5 on 2025-02-10 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('eis', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='emp_achievement', + name='a_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_confrence_organised', + name='k_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_expert_lectures', + name='l_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_keynote_address', + name='k_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_mtechphd_thesis', + name='s_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_patents', + name='p_year', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_published_books', + name='pyear', + field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), + ), + migrations.AlterField( + model_name='emp_research_papers', + name='year', + field=models.CharField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], max_length=10, null=True), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/admin.py b/FusionIIIT/applications/gymkhana/admin.py index 4f229113e..0139a3865 100644 --- a/FusionIIIT/applications/gymkhana/admin.py +++ b/FusionIIIT/applications/gymkhana/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import (Club_budget,Club_info,Club_member,Club_report,Fest_budget,Other_report,Session_info,Event_info,Registration_form,Form_available,Inventory,Budget,Budget_Comments,Event_Comments) +from .models import (Club_budget,Club_info,Club_member,Club_report,Fest_budget,Fest,Other_report,Session_info,Event_info,Registration_form,Form_available,Inventory,Budget,Budget_Comments,Event_Comments) # Register your models here. @@ -30,4 +30,5 @@ class ClubMemberAdmin(admin.ModelAdmin): admin.site.register(Inventory) admin.site.register(Budget) admin.site.register(Budget_Comments) -admin.site.register(Event_Comments) \ No newline at end of file +admin.site.register(Event_Comments) +admin.site.register(Fest) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 4504a833f..dbe74f607 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -3,7 +3,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from applications.gymkhana.models import Club_info,Session_info,Event_info -from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Fest,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition # class Voting_choicesSerializer(serializers.ModelSerializer): # class Meta: @@ -37,7 +37,7 @@ class Meta: class Club_DetailsSerializer(serializers.ModelSerializer): class Meta: model=Club_info - fields=['club_name',"co_ordinator","co_coordinator","activity_calender","category",'faculty_incharge',"club_file", "status"] + fields=['club_name',"co_ordinator","co_coordinator","activity_calender","category",'faculty_incharge',"club_file", "status" ,"description"] class Session_infoSerializer(serializers.ModelSerializer): class Meta: @@ -56,7 +56,7 @@ class club_budgetserializer(serializers.ModelSerializer): class Meta: model=Club_budget - fields=['club','budget_for','budget_amt','budget_file','status','id','description'] + fields=['club','budget_for','budget_amt','budget_file','status','id','description','remarks'] class Club_reportSerializers(serializers.ModelSerializer): class Meta: @@ -97,4 +97,9 @@ class Meta: class ClubPositionSerializer(serializers.ModelSerializer): class Meta: model = ClubPosition - fields = ['id', 'name', 'position', 'club'] \ No newline at end of file + fields = ['id', 'name', 'position', 'club'] + +class FestSerializer(serializers.ModelSerializer): + class Meta: + model=Fest + fields= ['id', 'name', 'category', 'description', 'date', 'link'] diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 0b9086fe1..bdc29fc50 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -7,12 +7,47 @@ from rest_framework.authentication import TokenAuthentication from rest_framework import status from rest_framework.views import APIView -from rest_framework.decorators import api_view, permission_classes,authentication_classes +from rest_framework.decorators import ( + api_view, + permission_classes, + authentication_classes, +) from rest_framework.permissions import AllowAny from rest_framework.response import Response from django.shortcuts import render -from applications.gymkhana.models import Registration_form, Student ,Club_info,Club_member,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Budget,Achievements,ClubPosition -from .serializers import Club_memberSerializer,Club_DetailsSerializer,Session_infoSerializer, event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer, Club_infoSerializer,BudgetSerializer,AchievementsSerializer,Event_CommentsSerializer,Budget_CommentsSerializer,ClubPositionSerializer +from applications.gymkhana.models import ( + Registration_form, + Student, + Club_info, + Club_member, + Session_info, + Event_info, + Club_budget, + Club_report, + Fest_budget, + Registration_form, + Budget, + Achievements, + ClubPosition, + Fest, +) +from .serializers import ( + Club_memberSerializer, + Club_DetailsSerializer, + Session_infoSerializer, + event_infoserializer, + club_budgetserializer, + Club_reportSerializers, + Fest_budgerSerializer, + Registration_formSerializer, + Club_infoSerializer, + BudgetSerializer, + AchievementsSerializer, + Event_CommentsSerializer, + Budget_CommentsSerializer, + ClubPositionSerializer, + FestSerializer, +) from django.contrib.auth.models import User from applications.gymkhana.views import * @@ -21,51 +56,71 @@ import base64 from rest_framework.parsers import MultiPartParser + + class Budgetinfo(APIView): def get(self, request): budgets = Budget.objects.all() serializer = BudgetSerializer(budgets, many=True) return Response(serializer.data) + class Club_Detail(APIView): def post(self, request): - club_name = request.data.get('club_name') + club_name = request.data.get("club_name") if not club_name: - return Response({"error": "club_name is required"}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "club_name is required"}, status=status.HTTP_400_BAD_REQUEST + ) clubdetail = get_object_or_404(Club_info, club_name=club_name) serializer = Club_DetailsSerializer(clubdetail) return Response(serializer.data, status=status.HTTP_200_OK) + + class UpcomingEventsAPIView(APIView): def get(self, request): - events = Event_info.objects.filter(start_date__gte=datetime.datetime.now()).order_by('start_date') + events = Event_info.objects.filter( + start_date__gte=datetime.datetime.now() + ).order_by("start_date") serializer = event_infoserializer(events, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + class PastEventsAPIView(APIView): def get(self, request): - events = Event_info.objects.filter(end_date__lt=datetime.datetime.now()).order_by('end_date') + events = Event_info.objects.filter( + end_date__lt=datetime.datetime.now() + ).order_by("end_date") serializer = event_infoserializer(events, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class UploadActivityCalendarAPIView(APIView): parser_classes = [MultiPartParser] def post(self, request, format=None): # Get the club name from the request data - club_name = request.data.get('club_name') + club_name = request.data.get("club_name") # Retrieve the club object from the database try: club = Club_info.objects.get(club_name=club_name) except Club_info.DoesNotExist: - return Response({'error': f'Club with name {club_name} does not exist'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": f"Club with name {club_name} does not exist"}, + status=status.HTTP_404_NOT_FOUND, + ) # Update the activity calendar file - club.activity_calender = request.data.get('activity_calender') + club.activity_calender = request.data.get("activity_calender") # Save the updated club object club.save() - return Response({'message': 'Activity calendar updated successfully'}, status=status.HTTP_200_OK) + return Response( + {"message": "Activity calendar updated successfully"}, + status=status.HTTP_200_OK, + ) # class VoteIncrementAPIView(APIView): @@ -73,7 +128,7 @@ def post(self, request, format=None): # serializer = Voting_choicesSerializer(data=request.data, many=True) # if not serializer.is_valid(): # return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - + # data = serializer.validated_data # for choice_data in data: # poll_event_id = choice_data.get('poll_event') @@ -84,8 +139,8 @@ def post(self, request, format=None): # choice_instance.save() # except Voting_choices.DoesNotExist: # pass # Do nothing if the choice with the given poll_event and title doesn't exist - - # return Response({'message': 'Votes incremented successfully'}, status=status.HTTP_200_OK) + +# return Response({'message': 'Votes incremented successfully'}, status=status.HTTP_200_OK) # class VotingPollsDeleteAPIView(APIView): @@ -95,7 +150,7 @@ def post(self, request, format=None): # Voting_poll = Voting_polls.objects.get(id=Voting_poll_id) # except Voting_polls.DoesNotExist: # return Response({"error": "Voting Poll not found."}, status=status.HTTP_404_NOT_FOUND) - + # # Delete the club member object # Voting_poll.delete() @@ -108,40 +163,55 @@ def post(self, request, format=None): # serializer = Voting_choicesSerializer(voting_choices, many=True) # return Response(serializer.data, status=status.HTTP_200_OK) + class ClubMemberApproveView(generics.UpdateAPIView): def post(self, request): - club_member_id = request.data.get('id') # Assuming the ID is sent in the request body + club_member_id = request.data.get( + "id" + ) # Assuming the ID is sent in the request body try: club_member = Club_member.objects.get(id=club_member_id) except Club_member.DoesNotExist: - return Response({"error": "Club member not found."}, status=status.HTTP_404_NOT_FOUND) - + return Response( + {"error": "Club member not found."}, status=status.HTTP_404_NOT_FOUND + ) + # Update the status of the club member - club_member.status = 'member' # Assuming 'member' is the status for approval + club_member.status = "member" # Assuming 'member' is the status for approval club_member.save() - return Response({"message": "Status updated successfully."}, status=status.HTTP_200_OK) + return Response( + {"message": "Status updated successfully."}, status=status.HTTP_200_OK + ) class ClubMemberDeleteAPIView(APIView): def post(self, request): - club_member_id = request.data.get('id') # Assuming the ID is sent in the request body + club_member_id = request.data.get( + "id" + ) # Assuming the ID is sent in the request body try: club_member = Club_member.objects.get(id=club_member_id) except Club_member.DoesNotExist: - return Response({"error": "Club member not found."}, status=status.HTTP_404_NOT_FOUND) - + return Response( + {"error": "Club member not found."}, status=status.HTTP_404_NOT_FOUND + ) + # Delete the club member object club_member.delete() - return Response({"message": "Club member deleted successfully."}, status=status.HTTP_204_NO_CONTENT) + return Response( + {"message": "Club member deleted successfully."}, + status=status.HTTP_204_NO_CONTENT, + ) + # class UpdateClubDetailsAPIView(APIView): # def post(self, request, *args, **kwargs): # club_name = request.data.get('club_name') # co_coordinator = request.data.get('co_coordinator') # co_ordinator = request.data.get('co_ordinator') - + # print(f"Received request data: club_name={club_name}, co_coordinator={co_coordinator}, co_ordinator={co_ordinator}") # # Retrieve the Club_info object by club_name @@ -149,9 +219,9 @@ def post(self, request): # club_info = Club_info.objects.get(club_name=club_name) # except Club_info.DoesNotExist: # return Response({"message": "Club not found"}, status=status.HTTP_404_NOT_FOUND) - + # print(f"Found Club_info object: {club_info}") - + # # Update the details provided in the request # serializer = Club_infoSerializer(instance=club_info, data={'co_coordinator': co_coordinator, 'co_ordinator': co_ordinator}, partial=True) # if serializer.is_valid(): @@ -163,83 +233,106 @@ def post(self, request): # print(f"Serializer errors: {serializer.errors}") # return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class ChangeHeadAPIView(APIView): def post(self, request): club = request.data.get("club_name") - co_ordinator = request.data.get('co_ordinator') - co_coordinator = request.data.get('co_coordinator') + co_ordinator = request.data.get("co_ordinator") + co_coordinator = request.data.get("co_coordinator") if not club or (not co_ordinator and not co_coordinator): - return JsonResponse({'status': 'error', 'message': 'Invalid request parameters'}) + return JsonResponse( + {"status": "error", "message": "Invalid request parameters"} + ) try: club_info = Club_info.objects.get(club_name=club) except Club_info.DoesNotExist: - return JsonResponse({'status': 'error', 'message': 'Club not found'}) + return JsonResponse({"status": "error", "message": "Club not found"}) message = "" if co_ordinator: - if not Club_member.objects.filter(club_id=club, member_id=co_ordinator).exists(): - return JsonResponse({'status': 'error', 'message': 'Selected student is not a member of the club'}) - + if not Club_member.objects.filter( + club_id=club, member_id=co_ordinator + ).exists(): + return JsonResponse( + { + "status": "error", + "message": "Selected student is not a member of the club", + } + ) + try: co_ordinator_student = Student.objects.get(id_id=co_ordinator) old_co_ordinator = club_info.co_ordinator_id club_info.co_ordinator_id = co_ordinator_student - + new_co_ordinator = HoldsDesignation( user=User.objects.get(username=co_ordinator), working=User.objects.get(username=co_ordinator), - designation=Designation.objects.get(name="co-ordinator") + designation=Designation.objects.get(name="co-ordinator"), ) new_co_ordinator.save() HoldsDesignation.objects.filter( user__username=old_co_ordinator, - designation=Designation.objects.get(name="co-ordinator") + designation=Designation.objects.get(name="co-ordinator"), ).delete() message += "Successfully changed co-ordinator !!!" except Student.DoesNotExist: - return JsonResponse({'status': 'error', 'message': 'Selected student not found'}) + return JsonResponse( + {"status": "error", "message": "Selected student not found"} + ) if co_coordinator: - if not Club_member.objects.filter(club_id=club, member_id=co_coordinator).exists(): - return JsonResponse({'status': 'error', 'message': 'Selected student is not a member of the club'}) + if not Club_member.objects.filter( + club_id=club, member_id=co_coordinator + ).exists(): + return JsonResponse( + { + "status": "error", + "message": "Selected student is not a member of the club", + } + ) try: co_coordinator_student = Student.objects.get(id_id=co_coordinator) old_co_coordinator = club_info.co_coordinator_id club_info.co_coordinator_id = co_coordinator_student - + new_co_coordinator = HoldsDesignation( user=User.objects.get(username=co_coordinator), working=User.objects.get(username=co_coordinator), - designation=Designation.objects.get(name="co co-ordinator") + designation=Designation.objects.get(name="co co-ordinator"), ) new_co_coordinator.save() HoldsDesignation.objects.filter( user__username=old_co_coordinator, - designation=Designation.objects.get(name="co co-ordinator") + designation=Designation.objects.get(name="co co-ordinator"), ).delete() message += "Successfully changed co-coordinator !!!" except Student.DoesNotExist: - return JsonResponse({'status': 'error', 'message': 'Selected student not found'}) + return JsonResponse( + {"status": "error", "message": "Selected student not found"} + ) club_info.head_changed_on = timezone.now() club_info.save() - return JsonResponse({'status': "success", 'message': message}) + return JsonResponse({"status": "success", "message": message}) + + class AddMemberToClub(APIView): def post(self, request): data = { - 'member': request.data.get('member'), - 'club': request.data.get('club'), - 'description': request.data.get('description'), - 'status': 'open' + "member": request.data.get("member"), + "club": request.data.get("club"), + "description": request.data.get("description"), + "status": "open", } serializer = Club_memberSerializer(data=data) if serializer.is_valid(): @@ -247,13 +340,15 @@ def post(self, request): return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class ClubMemberAPIView(APIView): def post(self, request): - club_member_id = request.data.get('club_name') + club_member_id = request.data.get("club_name") club_members = Club_member.objects.filter(club_id=club_member_id) serializer = Club_memberSerializer(club_members, many=True) - return Response(serializer.data,status=status.HTTP_200_OK) - + return Response(serializer.data, status=status.HTTP_200_OK) + + class RegistrationFormAPIView(APIView): """ API endpoint to handle registration form submissions. @@ -272,32 +367,42 @@ def post(self, request): branch = request.data.get("branch") programme = request.data.get("programme") print(programme) - + # Check if the user has already submitted the form if Registration_form.objects.filter(user_name=user_name).exists(): raise Exception("User has already filled the form.") # Saving data to the database - registration = Registration_form(user_name=user_name, branch=branch, roll=roll, cpi=cpi, programme=programme) + registration = Registration_form( + user_name=user_name, + branch=branch, + roll=roll, + cpi=cpi, + programme=programme, + ) try: registration.save() - # If no exception occurred, the save operation was successful + # If no exception occurred, the save operation was successful print("Save operation successful") serializer = Registration_formSerializer(registration) return Response(serializer.data, status=status.HTTP_201_CREATED) except Exception as e: - # If an exception occurred, print the error message or log it - print(f"Error occurred while saving registration: {e}") + # If an exception occurred, print the error message or log it + print(f"Error occurred while saving registration: {e}") print(registration.user_name) # Serialize the response - + except Exception as e: error_message = "Some error occurred" logger.error(f"Error in registration form submission: {e}") - return Response({"status": "error", "message": error_message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - + return Response( + {"status": "error", "message": error_message}, + status=status.HTTP_500_INTERNAL_SERVER_ERROR, + ) + + def coordinator_club(request): club_info = [] for club in Club_info.objects.all(): @@ -306,6 +411,7 @@ def coordinator_club(request): club_info.append(serialized_club) return club_info + # class core(APIView): # def get(self,request): # co=Core_team.objects.all() @@ -313,60 +419,73 @@ def coordinator_club(request): # print(serializer.data) # return Response(serializer.data) + class clubname(APIView): permission_classes = [IsAuthenticated] - def get(self,request): + + def get(self, request): authentication_classes = [TokenAuthentication] clubname1 = Club_info.objects.all() - serializer = Club_infoSerializer(clubname1, many = True) + serializer = Club_infoSerializer(clubname1, many=True) return Response(serializer.data) -class Club_Details(APIView): - def get(self,respect): - clubdetail=Club_info.objects.all() - serializer=Club_DetailsSerializer(clubdetail, many=True) +class Club_Details(APIView): + + def get(self, respect): + clubdetail = Club_info.objects.all() + serializer = Club_DetailsSerializer(clubdetail, many=True) return Response(serializer.data) + class session_details(APIView): - def get(self,respect): + def get(self, respect): session = Session_info.objects.all() - serializer = Session_infoSerializer(session, many = True) + serializer = Session_infoSerializer(session, many=True) return Response(serializer.data) + class club_events(APIView): - def get(self,respect): - clubevents=Event_info.objects.all() - serializer=event_infoserializer(clubevents, many = True) + def get(self, respect): + clubevents = Event_info.objects.all() + serializer = event_infoserializer(clubevents, many=True) return Response(serializer.data) + class club_budgetinfo(APIView): - def get(self,respect): - clubbudget=Club_budget.objects.all() - serializer=club_budgetserializer(clubbudget, many=True) + def get(self, respect): + clubbudget = Club_budget.objects.all() + serializer = club_budgetserializer(clubbudget, many=True) return Response(serializer.data) + class club_report(APIView): - def get(self,respect): + def get(self, respect): clubreport = Club_report.objects.all() - serializer = Club_reportSerializers(clubreport , many=True) + serializer = Club_reportSerializers(clubreport, many=True) return Response(serializer.data) + class Fest_Budget(APIView): - def get(self,respect): - festbudget=Fest_budget.objects.all() - serializer=Fest_budgerSerializer(festbudget, many=True) + def get(self, respect): + festbudget = Fest_budget.objects.all() + serializer = Fest_budgerSerializer(festbudget, many=True) return Response(serializer.data) + class Registraion_form(APIView): + def get(self, respect): + registration = Registration_form.objects.all() + serializer = Registration_formSerializer(registration, many=True) + return Response(serializer.data) +class FestListView(APIView): def get(self,respect): - registration=Registration_form.objects.all() - serializer=Registration_formSerializer(registration, many=True) + fests=Fest.objects.all(); + serializer=FestSerializer(fests, many=True) return Response(serializer.data) - # class Voting_Polls(APIView): # def get(self,respect): @@ -374,15 +493,16 @@ def get(self,respect): # serializer=Voting_pollSerializer(votingpolls, many=True) # return Response(serializer.data) + ##logger = logging.getLogger(_NamedFuncPointer) class NewSessionAPIView(APIView): def get(self, request): sessions = Session_info.objects.all() serializer = Session_infoSerializer(sessions, many=True) return Response(serializer.data) - + def post(self, request): - serializer =Session_infoSerializer(data=request.data) + serializer = Session_infoSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) @@ -394,16 +514,27 @@ def get(self, request): events = Event_info.objects.all() serializer = event_infoserializer(events, many=True) return Response(serializer.data) - + def post(self, request): serializer = event_infoserializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - - +class NewFestAPIView(APIView): + def get(self, request): + fests = Fest.objects.all() + serializer = FestSerializer(fests, many=True) + return Response(serializer.data) + + def post(self, request): + serializer = FestSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + print(serializer.errors) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) # class DeleteEventsView(APIView): # """ @@ -417,7 +548,7 @@ def post(self, request): # try: # events_deleted = [] # events_not_found = [] - + # # Ensure that request.data is a dictionary # event_data_list = request.data if isinstance(request.data, list) else [] @@ -452,59 +583,80 @@ def post(self, request): # except Exception as e: # return Response(str(e), status=status.HTTP_500_INTERNAL_SERVER_ERROR) + class EventDeleteAPIView(APIView): def post(self, request, *args, **kwargs): # Retrieve data from request event_data = request.data # Check if 'id' parameter is provided - if 'id' not in event_data: - return Response({'error': 'The "id" parameter is required'}, status=status.HTTP_400_BAD_REQUEST) + if "id" not in event_data: + return Response( + {"error": 'The "id" parameter is required'}, + status=status.HTTP_400_BAD_REQUEST, + ) # Get the event by id - event_id = event_data['id'] + event_id = event_data["id"] try: event = Event_info.objects.get(id=event_id) except Event_info.DoesNotExist: - return Response({'error': 'Event not found with the provided id'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Event not found with the provided id"}, + status=status.HTTP_404_NOT_FOUND, + ) # Delete the event event.delete() - return Response({'message': 'Event deleted successfully'}, status=status.HTTP_200_OK) + return Response( + {"message": "Event deleted successfully"}, status=status.HTTP_200_OK + ) class SessionUpdateAPIView(APIView): def post(self, request): - session_id = request.data.get('id') + session_id = request.data.get("id") if session_id is None: - return Response({'error': 'Session ID not provided'}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Session ID not provided"}, status=status.HTTP_400_BAD_REQUEST + ) try: session_instance = Session_info.objects.get(id=session_id) except Session_info.DoesNotExist: - return Response({'error': 'Session not found'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Session not found"}, status=status.HTTP_404_NOT_FOUND + ) - serializer = Session_infoSerializer(instance=session_instance, data=request.data, partial=True) + serializer = Session_infoSerializer( + instance=session_instance, data=request.data, partial=True + ) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - + class EventUpdateAPIView(APIView): def post(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") if event_id is None: - return Response({'error': 'Event ID not provided'}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Event ID not provided"}, status=status.HTTP_400_BAD_REQUEST + ) try: event_instance = Event_info.objects.get(id=event_id) except Event_info.DoesNotExist: - return Response({'error': 'Event not found'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND + ) - serializer = event_infoserializer(instance=event_instance, data=request.data, partial=True) + serializer = event_infoserializer( + instance=event_instance, data=request.data, partial=True + ) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) @@ -530,10 +682,10 @@ def post(self, request): # Iterate over each session data for session_data in session_data_list: - venue = session_data.get('venue') - date = session_data.get('date') - start_time = session_data.get('start_time') - end_time = session_data.get('end_time') + venue = session_data.get("venue") + date = session_data.get("date") + start_time = session_data.get("start_time") + end_time = session_data.get("end_time") # Query Session_info based on the provided parameters session = Session_info.objects.filter( @@ -551,7 +703,7 @@ def post(self, request): response_data = { "sessions_deleted": sessions_deleted, - "sessions_not_found": sessions_not_found + "sessions_not_found": sessions_not_found, } return JsonResponse(response_data, status=200) @@ -581,40 +733,49 @@ def post(self, request): # return Response({'voting_choices_errors': voting_choices_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) # else: # return Response({'voting_poll_errors': voting_poll_serializer.errors}, status=status.HTTP_400_BAD_REQUEST) - + + class UpdateClubBudgetAPIView(APIView): def post(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") if budget_id is None: - return Response({'error': 'Club budget ID not provided'}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Club budget ID not provided"}, + status=status.HTTP_400_BAD_REQUEST, + ) try: budget_instance = Club_budget.objects.get(pk=budget_id) except Club_budget.DoesNotExist: - return Response({'error': 'Club budget not found'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Club budget not found"}, status=status.HTTP_404_NOT_FOUND + ) - serializer = club_budgetserializer(instance=budget_instance, data=request.data, partial = True) + serializer = club_budgetserializer( + instance=budget_instance, data=request.data, partial=True + ) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class AddClub_BudgetAPIView(APIView): def post(self, request): # Get the string representation of the file content - budget_file_content = request.data.get('budget_file') + budget_file_content = request.data.get("budget_file") # Convert the string to a file object file_obj = None if budget_file_content: - # Create a ContentFile object - file_obj = ContentFile(budget_file_content.encode(), name='temp_file.txt') + # Create a ContentFile object + file_obj = ContentFile(budget_file_content.encode(), name="temp_file.txt") -# Update the request data with the File object - request.data['budget_file'] = file_obj + # Update the request data with the File object + request.data["budget_file"] = file_obj # Update the request data with the file object - request.data['budget_file'] = file_obj + request.data["budget_file"] = file_obj # Initialize the serializer with the modified request data serializer = club_budgetserializer(data=request.data) @@ -623,22 +784,29 @@ def post(self, request): if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class DeleteClubBudgetAPIView(APIView): def post(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") if budget_id is None: - return Response({'error': 'Club budget ID not provided'}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Club budget ID not provided"}, + status=status.HTTP_400_BAD_REQUEST, + ) try: budget_instance = Club_budget.objects.get(pk=budget_id) except Club_budget.DoesNotExist: - return Response({'error': 'Club budget not found'}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Club budget not found"}, status=status.HTTP_404_NOT_FOUND + ) budget_instance.delete() - return Response({'message': 'Club budget deleted successfully'}, status=status.HTTP_200_OK) + return Response( + {"message": "Club budget deleted successfully"}, status=status.HTTP_200_OK + ) class DeleteClubAPIView(APIView): @@ -647,15 +815,19 @@ def post(self, request): club_data = request.data # Extract fields for filtering - club_name = club_data.get('club_name') - category = club_data.get('category') - co_ordinator = club_data.get('co_ordinator') - co_coordinator = club_data.get('co_coordinator') - faculty_incharge = club_data.get('faculty_incharge') + club_name = club_data.get("club_name") + category = club_data.get("category") + co_ordinator = club_data.get("co_ordinator") + co_coordinator = club_data.get("co_coordinator") + faculty_incharge = club_data.get("faculty_incharge") # Check if all required fields are provided - if not all([club_name, category, co_ordinator, co_coordinator, faculty_incharge]): - return Response({"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST) + if not all( + [club_name, category, co_ordinator, co_coordinator, faculty_incharge] + ): + return Response( + {"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST + ) # Try to find the club based on provided fields try: @@ -664,16 +836,20 @@ def post(self, request): category=category, co_ordinator=co_ordinator, co_coordinator=co_coordinator, - faculty_incharge=faculty_incharge + faculty_incharge=faculty_incharge, ) except Club_info.DoesNotExist: - return Response({"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND + ) # Delete the club from the database club.delete() - return Response({"message": "Club deleted successfully"}, status=status.HTTP_200_OK) - + return Response( + {"message": "Club deleted successfully"}, status=status.HTTP_200_OK + ) + # class ClubCreateAPIView(APIView): # def post(self, request, format=None): @@ -700,18 +876,20 @@ def post(self, request): class CreateClubAPIView(APIView): def post(self, request): # Get the string representation of the file content for club_file - club_file_content = request.data.get('club_file') + club_file_content = request.data.get("club_file") # Convert the string to a file object for club_file club_file_obj = None if club_file_content: - club_file_obj = ContentFile(club_file_content.encode(), name='club_file.txt') + club_file_obj = ContentFile( + club_file_content.encode(), name="club_file.txt" + ) # Update the request data with the file object for club_file - request.data['club_file'] = club_file_obj + request.data["club_file"] = club_file_obj # Get the string representation of the file content for activity_calendar - description = request.data.get('description') + description = request.data.get("description") # Initialize the serializer with the modified request data serializer = Club_infoSerializer(data=request.data) @@ -723,21 +901,22 @@ def post(self, request): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - class UpdateClubStatusAPIView(APIView): def post(self, request): # Retrieve data from request club_data = request.data # Extract fields for filtering - club_name = club_data.get('club_name') - co_ordinator = club_data.get('co_ordinator') - co_coordinator = club_data.get('co_coordinator') - faculty_incharge = club_data.get('faculty_incharge') + club_name = club_data.get("club_name") + co_ordinator = club_data.get("co_ordinator") + co_coordinator = club_data.get("co_coordinator") + faculty_incharge = club_data.get("faculty_incharge") # Check if all required fields are provided if not all([club_name, co_ordinator, co_coordinator, faculty_incharge]): - return Response({"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST + ) # Try to find the club based on provided fields try: @@ -745,20 +924,21 @@ def post(self, request): club_name=club_name, co_ordinator=co_ordinator, co_coordinator=co_coordinator, - faculty_incharge=faculty_incharge + faculty_incharge=faculty_incharge, ) except Club_info.DoesNotExist: - return Response({"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND + ) # Update the status of the club - club.status = 'confirmed' + club.status = "confirmed" club.save() - return Response({"message": "Club status updated to 'confirmed' successfully"}, status=status.HTTP_200_OK) - - - - + return Response( + {"message": "Club status updated to 'confirmed' successfully"}, + status=status.HTTP_200_OK, + ) # class UpdateClubNameAPIView(APIView): @@ -795,22 +975,25 @@ def post(self, request): # return Response({"message": "Club name updated successfully"}, status=status.HTTP_200_OK) - class UpdateClubNameAPIView(APIView): def post(self, request): # Retrieve data from request club_data = request.data # Extract fields for filtering - club_name = club_data.get('club_name') - co_ordinator = club_data.get('co_ordinator') - co_coordinator = club_data.get('co_coordinator') - faculty_incharge = club_data.get('faculty_incharge') - new_club = club_data.get('new_club') + club_name = club_data.get("club_name") + co_ordinator = club_data.get("co_ordinator") + co_coordinator = club_data.get("co_coordinator") + faculty_incharge = club_data.get("faculty_incharge") + new_club = club_data.get("new_club") # Check if all required fields are provided - if not all([club_name, co_ordinator, co_coordinator, faculty_incharge, new_club]): - return Response({"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST) + if not all( + [club_name, co_ordinator, co_coordinator, faculty_incharge, new_club] + ): + return Response( + {"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST + ) # Try to find the club based on provided fields try: @@ -818,14 +1001,19 @@ def post(self, request): club_name=club_name, co_ordinator=co_ordinator, co_coordinator=co_coordinator, - faculty_incharge=faculty_incharge + faculty_incharge=faculty_incharge, ) except Club_info.DoesNotExist: - return Response({"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Club not found"}, status=status.HTTP_404_NOT_FOUND + ) # Check if a club with the new name already exists if Club_info.objects.filter(club_name=new_club).exists(): - return Response({"error": f"A club with the name '{new_club}' already exists"}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": f"A club with the name '{new_club}' already exists"}, + status=status.HTTP_400_BAD_REQUEST, + ) # Update the status of the club club.club_name = new_club @@ -834,139 +1022,214 @@ def post(self, request): # Delete the original club entry Club_info.objects.filter(club_name=club_name).delete() - return Response({"message": "Club name updated successfully"}, status=status.HTTP_200_OK) - + return Response( + {"message": "Club name updated successfully"}, status=status.HTTP_200_OK + ) class ApproveEvent(APIView): def post(self, request): event_data = request.data - event_name = event_data.get('event_name') - incharge = event_data.get('incharge') - date = event_data.get('date') - venue = event_data.get('venue') - event_id = event_data.get('id') + event_name = event_data.get("event_name") + incharge = event_data.get("incharge") + date = event_data.get("date") + venue = event_data.get("venue") + event_id = event_data.get("id") if not all([event_name, incharge, date, venue, event_id]): - return Response({"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST) + return Response( + {"error": "Missing required fields"}, status=status.HTTP_400_BAD_REQUEST + ) try: event = Event_info.objects.get( event_name=event_name, incharge=incharge, date=date, venue=venue, - id=event_id + id=event_id, ) except Event_info.DoesNotExist: - return Response({"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND) - event.status = 'confirmed' + return Response( + {"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND + ) + event.status = "confirmed" event.save() - return Response({"message": "event status updated successfully"}, status=status.HTTP_200_OK) - + return Response( + {"message": "event status updated successfully"}, status=status.HTTP_200_OK + ) + + class AddClubAPI(APIView): def post(self, request): serializer = Club_infoSerializer(data=request.data) if serializer.is_valid(): serializer.save() - return Response({"message": "Club added successfully!"}, status=status.HTTP_201_CREATED) + return Response( + {"message": "Club added successfully!"}, status=status.HTTP_201_CREATED + ) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class NewEventAPIView(APIView): def put(self, request): - request.data['status'] = 'FIC' + request.data["status"] = "FIC" serializer = event_infoserializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class FICApproveEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - if event.status != 'FIC': - return Response({"error": "Event is not under FIC review."}, status=status.HTTP_400_BAD_REQUEST) - event.status = 'COUNSELLOR' + if event.status != "FIC": + return Response( + {"error": "Event is not under FIC review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + event.status = "COUNSELLOR" event.save() - return Response({"message": "Event status changed to 'Counsellor Review'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Counsellor Review'."}, + status=status.HTTP_200_OK, + ) + + class CounsellorApproveEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - if event.status != 'COUNSELLOR': - return Response({"error": "Event is not under Counsellor review."}, status=status.HTTP_400_BAD_REQUEST) - event.status = 'DEAN' + if event.status != "COUNSELLOR": + return Response( + {"error": "Event is not under Counsellor review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + event.status = "DEAN" event.save() - return Response({"message": "Event status changed to 'Dean Review'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Dean Review'."}, + status=status.HTTP_200_OK, + ) + + class DeanApproveEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - if event.status != 'DEAN': - return Response({"error": "Event is not under Dean review."}, status=status.HTTP_400_BAD_REQUEST) - event.status = 'ACCEPT' + if event.status != "DEAN": + return Response( + {"error": "Event is not under Dean review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + event.status = "ACCEPT" event.save() - return Response({"message": "Event status changed to 'Accepted'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Accepted'."}, + status=status.HTTP_200_OK, + ) + + class NewBudgetAPIView(APIView): def put(self, request): - request.data['status'] = 'FIC' + request.data["status"] = "FIC" serializer = BudgetSerializer(data=request.data) if serializer.is_valid(): - serializer.save() + serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class FICApproveBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") budget = get_object_or_404(Budget, id=budget_id) - if budget.status != 'FIC': - return Response({"error": "Budget is not under FIC review."}, status=status.HTTP_400_BAD_REQUEST) - budget.status = 'COUNSELLOR' + if budget.status != "FIC": + return Response( + {"error": "Budget is not under FIC review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + budget.status = "COUNSELLOR" budget.save() - return Response({"message": "Budget status changed to 'Counsellor Review'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Budget status changed to 'Counsellor Review'."}, + status=status.HTTP_200_OK, + ) + + class CounsellorApproveBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") budget = get_object_or_404(Budget, id=budget_id) - if budget.status != 'COUNSELLOR': - return Response({"error": "Budget is not under Counsellor review."}, status=status.HTTP_400_BAD_REQUEST) - budget.status = 'DEAN' + if budget.status != "COUNSELLOR": + return Response( + {"error": "Budget is not under Counsellor review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + budget.status = "DEAN" budget.save() - return Response({"message": "Budget status changed to 'Dean Review'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Budget status changed to 'Dean Review'."}, + status=status.HTTP_200_OK, + ) + + class DeanApproveBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") budget = get_object_or_404(Budget, id=budget_id) - if budget.status != 'DEAN': - return Response({"error": "Budget is not under Dean review."}, status=status.HTTP_400_BAD_REQUEST) - budget.status = 'ACCEPT' + if budget.status != "DEAN": + return Response( + {"error": "Budget is not under Dean review."}, + status=status.HTTP_400_BAD_REQUEST, + ) + budget.status = "ACCEPT" budget.save() - return Response({"message": "Budget status changed to 'Accepted'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Budget status changed to 'Accepted'."}, + status=status.HTTP_200_OK, + ) + + class RejectBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") budget = get_object_or_404(Budget, id=budget_id) - budget.status = 'REJECT' + budget.status = "REJECT" budget.save() - return Response({"message": "Budget status changed to 'Rejected'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Budget status changed to 'Rejected'."}, + status=status.HTTP_200_OK, + ) + + class RejectEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - event.status = 'REJECT' + event.status = "REJECT" event.save() - return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Rejected'."}, + status=status.HTTP_200_OK, + ) + + class AchievementsAPIView(APIView): def post(self, request): - club_name = request.data.get('club_name') - achievements = Achievements.objects.filter(club_name=club_name) + club_name = request.data.get("club_name") + achievements = Achievements.objects.filter(club_name=club_name) if not achievements.exists(): - return Response({"message": "No achievements found for this club."}, status=404) + return Response( + {"message": "No achievements found for this club."}, status=404 + ) serializer = AchievementsSerializer(achievements, many=True) return Response(serializer.data, status=200) + + class AddAchievementAPIView(APIView): def post(self, request): serializer = AchievementsSerializer(data=request.data) @@ -974,76 +1237,112 @@ def post(self, request): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class CreateBudgetCommentAPIView(APIView): def post(self, request): data = request.data.copy() - data['comment_date'] = timezone.now().date() - data['comment_time'] = timezone.now().time() - + data["comment_date"] = timezone.now().date() + data["comment_time"] = timezone.now().time() + serializer = Budget_CommentsSerializer(data=data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class CreateEventCommentAPIView(APIView): def post(self, request): data = request.data.copy() - data['comment_date'] = timezone.now().date() - data['comment_time'] = timezone.now().time() - + data["comment_date"] = timezone.now().date() + data["comment_time"] = timezone.now().time() + serializer = Event_CommentsSerializer(data=data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class ListBudgetCommentsAPIView(APIView): def post(self, request): - budget_id = request.data.get('budget_id') + budget_id = request.data.get("budget_id") if not budget_id: - return Response({"error": "Budget ID is required."}, status=status.HTTP_400_BAD_REQUEST) - - comments = Budget_Comments.objects.filter(budget_id=budget_id).order_by('comment_date', 'comment_time') + return Response( + {"error": "Budget ID is required."}, status=status.HTTP_400_BAD_REQUEST + ) + + comments = Budget_Comments.objects.filter(budget_id=budget_id).order_by( + "comment_date", "comment_time" + ) serializer = Budget_CommentsSerializer(comments, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class ListEventCommentsAPIView(APIView): def post(self, request): - event_id = request.data.get('event_id') + event_id = request.data.get("event_id") if not event_id: - return Response({"error": "Event ID is required."}, status=status.HTTP_400_BAD_REQUEST) - - comments = Event_Comments.objects.filter(event_id=event_id).order_by('comment_date', 'comment_time') + return Response( + {"error": "Event ID is required."}, status=status.HTTP_400_BAD_REQUEST + ) + + comments = Event_Comments.objects.filter(event_id=event_id).order_by( + "comment_date", "comment_time" + ) serializer = Event_CommentsSerializer(comments, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class RejectEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - event.status = 'REJECT' + event.status = "REJECT" event.save() - return Response({"message": "Event status changed to 'Rejected'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Rejected'."}, + status=status.HTTP_200_OK, + ) + + class ModifyEventAPIView(APIView): def put(self, request): - event_id = request.data.get('id') + event_id = request.data.get("id") event = get_object_or_404(Event_info, id=event_id) - event.status = 'COORDINATOR' + event.status = "COORDINATOR" event.save() - return Response({"message": "Event status changed to 'Coordinator review'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Event status changed to 'Coordinator review'."}, + status=status.HTTP_200_OK, + ) + + class ModifyBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get('id') + budget_id = request.data.get("id") budget = get_object_or_404(Budget, id=budget_id) - budget.status = 'COORDINATOR' + budget.status = "COORDINATOR" budget.save() - return Response({"message": "Budget status changed to 'Coordinator Review'."}, status=status.HTTP_200_OK) - + return Response( + {"message": "Budget status changed to 'Coordinator Review'."}, + status=status.HTTP_200_OK, + ) + + class RejectMemberAPIView(APIView): def put(self, request): - member_id = request.data.get('id') + member_id = request.data.get("id") member = get_object_or_404(Club_member, id=member_id) - member.status = 'rejected' + member.status = "rejected" member.save() - return Response({"message": "Member status changed to 'rejected'."}, status=status.HTTP_200_OK) + return Response( + {"message": "Member status changed to 'rejected'."}, + status=status.HTTP_200_OK, + ) + + class AddClubPositionAPIView(APIView): def post(self, request): serializer = ClubPositionSerializer(data=request.data) @@ -1051,29 +1350,35 @@ def post(self, request): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class ListClubPositionAPIView(APIView): def post(self, request): - name=request.data.get('name') + name = request.data.get("name") positions = ClubPosition.objects.filter(name=name) serializer = ClubPositionSerializer(positions, many=True) return Response(serializer.data, status=status.HTTP_200_OK) + + class UpdateEventAPIView(APIView): def put(self, request): try: # Fetch the event to be updated - pk = request.data.get('id') + pk = request.data.get("id") event = Event_info.objects.get(pk=pk) except Event_info.DoesNotExist: - return Response({"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND) - + return Response( + {"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND + ) + # Partial update for 'details' and 'event_poster' data = {} - if 'details' in request.data: - data['details'] = request.data['details'] - if 'event_poster' in request.FILES: - data['event_poster'] = request.FILES['event_poster'] - data['status'] = 'FIC' - + if "details" in request.data: + data["details"] = request.data["details"] + if "event_poster" in request.FILES: + data["event_poster"] = request.FILES["event_poster"] + data["status"] = "FIC" + # Create serializer instance with partial=True to allow partial updates serializer = event_infoserializer(event, data=data, partial=True) @@ -1081,4 +1386,35 @@ def put(self, request): if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + +class UpdateBudgetAPIView(APIView): + def put(self, request): + try: + # Fetch the event to be updated + pk = request.data.get("id") + budget = Budget.objects.get(pk=pk) + except Budget.DoesNotExist: + return Response( + {"error": "Event not found"}, status=status.HTTP_404_NOT_FOUND + ) + + # Partial update for 'details' and 'event_poster' + data = {} + if "budget_amt" in request.data: + data["budget_amt"] = request.data["budget_amt"] + if "remarks" in request.data: + data["remarks"] = request.data["remarks"] + if "budget_file" in request.FILES: + data["budget_file"] = request.FILES["budget_file"] + data["status"] = "FIC" + + # Create serializer instance with partial=True to allow partial updates + serializer = BudgetSerializer(budget, data=data, partial=True) + + # Validate and update + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) diff --git a/FusionIIIT/applications/gymkhana/migrations/0007_fest.py b/FusionIIIT/applications/gymkhana/migrations/0007_fest.py new file mode 100644 index 000000000..b43454cfd --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0007_fest.py @@ -0,0 +1,27 @@ +# Generated by Django 3.1.5 on 2025-02-10 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0006_clubposition'), + ] + + operations = [ + migrations.CreateModel( + name='Fest', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('name', models.CharField(max_length=50)), + ('category', models.CharField(max_length=50)), + ('description', models.TextField(max_length=256, null=True)), + ('date', models.DateField(default=None)), + ('link', models.CharField(max_length=256, null=True)), + ], + options={ + 'db_table': 'fest', + }, + ), + ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py b/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py new file mode 100644 index 000000000..dc06e5c21 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2025-02-17 17:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0007_fest'), + ] + + operations = [ + migrations.AlterField( + model_name='fest', + name='category', + field=models.CharField(choices=[('Technical', 'Technical'), ('Sports', 'Sports'), ('Cultural', 'Cultural')], max_length=50), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 522e12525..9869c5b5a 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -358,6 +358,18 @@ def __str__(self): class Meta: db_table = "Club_report" +class Fest(models.Model): + id=models.AutoField(primary_key=True) + name=models.CharField(max_length=50, null=False) + category=models.CharField(max_length=50, null=False, choices=Constants.categoryCh) + description=models.TextField(max_length=256, null=True) + date = models.DateField(default=None, auto_now=False, null=False) + link=models.CharField(max_length=256, null=True) + + def _str_(self): + return str(self.id) + class Meta: + db_table="fest" class Fest_budget(models.Model): """ diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 3a1d2fd7b..154042414 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -1,17 +1,74 @@ from django.conf.urls import url from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns -from applications.gymkhana.api.views import AddClub_BudgetAPIView, AddMemberToClub, ApproveEvent, ChangeHeadAPIView, ClubMemberAPIView, ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, UpdateClubStatusAPIView, UploadActivityCalendarAPIView,ModifyEventAPIView,ModifyBudgetAPIView,RejectEventAPIView,RejectBudgetAPIView,UpdateEventAPIView -from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form -from applications.gymkhana.api.views import session_details -from applications.gymkhana.api.views import DeleteSessionsView, NewEventAPIView, NewSessionAPIView,Club_Detail,UpcomingEventsAPIView,PastEventsAPIView,Budgetinfo,AddClubAPI,NewBudgetAPIView,FICApproveBudgetAPIView,CounsellorApproveBudgetAPIView,DeanApproveBudgetAPIView,FICApproveEventAPIView,CounsellorApproveEventAPIView,DeanApproveEventAPIView,AddAchievementAPIView,AchievementsAPIView,CreateBudgetCommentAPIView,CreateEventCommentAPIView,ListBudgetCommentsAPIView,ListEventCommentsAPIView,AddClubPositionAPIView,ListClubPositionAPIView +from applications.gymkhana.api.views import ( + AddClub_BudgetAPIView, + AddMemberToClub, + ApproveEvent, + ChangeHeadAPIView, + ClubMemberAPIView, + ClubMemberApproveView, + ClubMemberDeleteAPIView, + CreateClubAPIView, + DeleteClubAPIView, + DeleteClubBudgetAPIView, + EventDeleteAPIView, + EventUpdateAPIView, + SessionUpdateAPIView, + UpdateClubBudgetAPIView, + UpdateClubNameAPIView, + UpdateClubStatusAPIView, + UploadActivityCalendarAPIView, + ModifyEventAPIView, + ModifyBudgetAPIView, + RejectEventAPIView, + RejectBudgetAPIView, + UpdateEventAPIView, + FestListView, +) +from applications.gymkhana.api.views import ( + clubname, + Club_Details, + club_events, + club_budgetinfo, + Fest_Budget, + club_report, + Registraion_form, +) +from applications.gymkhana.api.views import session_details, UpdateBudgetAPIView +from applications.gymkhana.api.views import ( + DeleteSessionsView, + NewEventAPIView, + NewSessionAPIView, + Club_Detail, + UpcomingEventsAPIView, + PastEventsAPIView, + Budgetinfo, + AddClubAPI, + NewBudgetAPIView, + FICApproveBudgetAPIView, + CounsellorApproveBudgetAPIView, + DeanApproveBudgetAPIView, + FICApproveEventAPIView, + CounsellorApproveEventAPIView, + DeanApproveEventAPIView, + AddAchievementAPIView, + AchievementsAPIView, + CreateBudgetCommentAPIView, + CreateEventCommentAPIView, + ListBudgetCommentsAPIView, + ListEventCommentsAPIView, + AddClubPositionAPIView, + ListClubPositionAPIView, + NewFestAPIView, +) from . import views from rest_framework.authtoken.views import obtain_auth_token -app_name = 'gymkhana' +app_name = "gymkhana" urlpatterns = [ - #for club_detail,upcomingevents and past events + # for club_detail,upcomingevents and past events url(r"^club_detail/$", Club_Detail.as_view()), url(r"^upcoming_events/$", UpcomingEventsAPIView.as_view()), url(r"^past_events/$", PastEventsAPIView.as_view()), @@ -69,10 +126,8 @@ url(r"^date_events/$", views.date_events, name="date_events"), url(r"^delete_sessions/$", views.delete_sessions, name="delete_sessions"), url(r"^delete_events/$", views.delete_events, name="delete_events"), - url(r"^(?P\d+)/edit_event/$", - views.edit_event, name="edit_event"), - url(r"^(?P\d+)/editsession/$", - views.editsession, name="editsession"), + url(r"^(?P\d+)/edit_event/$", views.edit_event, name="edit_event"), + url(r"^(?P\d+)/editsession/$", views.editsession, name="editsession"), url(r"^delete_memberform/$", views.delete_memberform, name="delete_memberform"), # url(r'^voting_poll/$', views.voting_poll, name='voting_poll'), # url(r'^delete_poll/(?P\d+)/$', views.delete_poll, name='delete_poll'), @@ -86,8 +141,7 @@ url(r"^form_avail/$", views.form_avail, name="form_avail"), url(r"^faculty_data/$", views.facultyData, name="faculty_data"), url(r"^students_data/$", views.studentsData, name="students_data"), - url(r"^students_club_members/$", - views.studentsClubMembers, name="students_data"), + url(r"^students_club_members/$", views.studentsClubMembers, name="students_data"), url(r"^get_venue/$", views.getVenue, name="get_venue"), # core_team # url(r"^core_team/$", views.core_team, name="core_team"), @@ -96,8 +150,12 @@ # url(r"^Inventory_update/$", views.core_team, name="Inventory_update"), url(r"^del_club/$", views.del_club, name="del_club"), url(r"^approve_events/$", views.approve_events, name="approve_events"), - url(r"^update-club-name/$", views.update_club_name, name='update-club-name'), - url(r"^update-budget-amount/$", views.update_budget_amount, name='update_budget_amount'), + url(r"^update-club-name/$", views.update_club_name, name="update-club-name"), + url( + r"^update-budget-amount/$", + views.update_budget_amount, + name="update_budget_amount", + ), # url(r"^update-spent-amount/$", views.update_spent_amount, name='update_spent_amount'), @@ -120,44 +178,113 @@ # url(r'^api/show_voting_choices/$', ShowVotingChoicesAPIView.as_view(), name='voting_choices'), # url(r'^api/delete_poll/$', VotingPollsDeleteAPIView.as_view(), name='delete poll'), # url(r'^api/vote/$', VoteIncrementAPIView.as_view(), name='give vote'), - url(r'^api/edit_session/$', SessionUpdateAPIView.as_view(), name='edit session'), - url(r'^api/edit_event/$', EventUpdateAPIView.as_view(), name='edit event'), - url(r'^api/delete_budget/$',DeleteClubBudgetAPIView.as_view(), name='delete budget'), - url(r'^api/upload_activitycalender/$', UploadActivityCalendarAPIView.as_view(), name='calender'), - url(r'^api/create_club/$', CreateClubAPIView.as_view(), name='new club'), - url(r'^api/update_clubStatus/$', UpdateClubStatusAPIView.as_view(),name = 'update club status' ), - url(r'^api/updateClubName/$', UpdateClubNameAPIView.as_view(), name = 'update club name'), - url(r'^api/approve_event/$', ApproveEvent.as_view(), name = 'approve event'), - #add club api - url(r'^api/add_club/$', AddClubAPI.as_view(), name='add club'), - #new budget api - url(r'^api/new_budget/$', NewBudgetAPIView.as_view(), name='new budget'), - #fic approve budget api - url(r'^api/fic_approve_budget/$', FICApproveBudgetAPIView.as_view(), name='fic approve budget'), - #counsellor approve budget api - url(r'^api/counsellor_approve_budget/$', CounsellorApproveBudgetAPIView.as_view(), name='counsellor approve budget'), - #dean approve budget api - url(r'^api/dean_approve_budget/$', DeanApproveBudgetAPIView.as_view(), name='dean approve budget'), - #new event api - url(r'^api/new_events/$', NewEventAPIView.as_view(), name='new events'), - #fic approve event api - url(r'^api/fic_approve_event/$', FICApproveEventAPIView.as_view(), name='fic approve event'), - #counsellor approve event api - url(r'^api/counsellor_approve_event/$', CounsellorApproveEventAPIView.as_view(), name='counsellor approve event'), - #dean approve event api - url(r'^api/dean_approve_event/$', DeanApproveEventAPIView.as_view(), name='dean approve event'), - url(r'^api/add_achievement/$', AddAchievementAPIView.as_view(), name = 'approve event'), - url(r'^api/show_achievement/$', AchievementsAPIView.as_view(), name = 'approve event'), - url(r'^api/create_budget_comment/$', CreateBudgetCommentAPIView.as_view(), name='create budget comment'), - url(r'^api/create_event_comment/$', CreateEventCommentAPIView.as_view(), name='create event comment'), - url(r'^api/list_budget_comments/$', ListBudgetCommentsAPIView.as_view(),name='list budget comments'), - url(r'^api/list_event_comments/$', ListEventCommentsAPIView.as_view(), name='list event comments'), - url(r'^api/modify_event/$', ModifyEventAPIView.as_view(), name='modify event'), - url(r'^api/modify_budget/$', ModifyBudgetAPIView.as_view(), name='modify budget'), - url(r'^api/reject_event/$', RejectEventAPIView.as_view(), name='reject event'), - url(r'^api/reject_budget/$', RejectBudgetAPIView.as_view(), name='reject budget'), - url(r'^api/add_club_position/$', AddClubPositionAPIView.as_view(), name='add club position'), - url(r'^api/list_club_position/$', ListClubPositionAPIView.as_view(), name='list club position'), - url(r'^/api/new_event/$', UpdateEventAPIView.as_view(), name='update event'), - url(r'^api/update_event/$', UpdateEventAPIView.as_view(), name='update event'), + url(r"^api/edit_session/$", SessionUpdateAPIView.as_view(), name="edit session"), + url(r"^api/edit_event/$", EventUpdateAPIView.as_view(), name="edit event"), + url( + r"^api/delete_budget/$", DeleteClubBudgetAPIView.as_view(), name="delete budget" + ), + url( + r"^api/upload_activitycalender/$", + UploadActivityCalendarAPIView.as_view(), + name="calender", + ), + url(r"^api/create_club/$", CreateClubAPIView.as_view(), name="new club"), + url( + r"^api/update_clubStatus/$", + UpdateClubStatusAPIView.as_view(), + name="update club status", + ), + url( + r"^api/updateClubName/$", + UpdateClubNameAPIView.as_view(), + name="update club name", + ), + url(r"^api/approve_event/$", ApproveEvent.as_view(), name="approve event"), + # add club api + url(r"^api/add_club/$", AddClubAPI.as_view(), name="add club"), + # new budget api + url(r"^api/new_budget/$", NewBudgetAPIView.as_view(), name="new budget"), + # fic approve budget api + url( + r"^api/fic_approve_budget/$", + FICApproveBudgetAPIView.as_view(), + name="fic approve budget", + ), + # counsellor approve budget api + url( + r"^api/counsellor_approve_budget/$", + CounsellorApproveBudgetAPIView.as_view(), + name="counsellor approve budget", + ), + # dean approve budget api + url( + r"^api/dean_approve_budget/$", + DeanApproveBudgetAPIView.as_view(), + name="dean approve budget", + ), + # new event api + url(r"^api/new_events/$", NewEventAPIView.as_view(), name="new events"), + # fic approve event api + url( + r"^api/fic_approve_event/$", + FICApproveEventAPIView.as_view(), + name="fic approve event", + ), + # counsellor approve event api + url( + r"^api/counsellor_approve_event/$", + CounsellorApproveEventAPIView.as_view(), + name="counsellor approve event", + ), + # dean approve event api + url( + r"^api/dean_approve_event/$", + DeanApproveEventAPIView.as_view(), + name="dean approve event", + ), + url( + r"^api/add_achievement/$", AddAchievementAPIView.as_view(), name="approve event" + ), + url( + r"^api/show_achievement/$", AchievementsAPIView.as_view(), name="approve event" + ), + url( + r"^api/create_budget_comment/$", + CreateBudgetCommentAPIView.as_view(), + name="create budget comment", + ), + url( + r"^api/create_event_comment/$", + CreateEventCommentAPIView.as_view(), + name="create event comment", + ), + url( + r"^api/list_budget_comments/$", + ListBudgetCommentsAPIView.as_view(), + name="list budget comments", + ), + url( + r"^api/list_event_comments/$", + ListEventCommentsAPIView.as_view(), + name="list event comments", + ), + url(r"^api/modify_event/$", ModifyEventAPIView.as_view(), name="modify event"), + url(r"^api/modify_budget/$", ModifyBudgetAPIView.as_view(), name="modify budget"), + url(r"^api/reject_event/$", RejectEventAPIView.as_view(), name="reject event"), + url(r"^api/reject_budget/$", RejectBudgetAPIView.as_view(), name="reject budget"), + url( + r"^api/add_club_position/$", + AddClubPositionAPIView.as_view(), + name="add club position", + ), + url( + r"^api/list_club_position/$", + ListClubPositionAPIView.as_view(), + name="list club position", + ), + url(r"^/api/new_event/$", UpdateEventAPIView.as_view(), name="update event"), + url(r"^api/update_event/$", UpdateEventAPIView.as_view(), name="update event"), + url(r"^api/update_budget/$", UpdateBudgetAPIView.as_view(), name="update budget"), + url(r"^fest/$" , FestListView.as_view(), name="fest"), + url(r'^api/new_fest/$', NewFestAPIView.as_view(), name='new_fest'), ] diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index e694fb742..259bdedd3 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -133,8 +133,7 @@ def editsession(request, session_id): end_time = body.get("end_time") desc = body.get("d_d") club_name = coordinator_club(request) - result = conflict_algorithm_session( - date, start_time, end_time, venue) + result = conflict_algorithm_session(date, start_time, end_time, venue) message = "" if result == "success": event = Session_info.objects.select_related( @@ -288,8 +287,7 @@ def edit_event(request, event_id): end_time = body.get("end_time") desc = body.get("d_d") club_name = coordinator_club(request) - result = conflict_algorithm_event( - date, start_time, end_time, venue) + result = conflict_algorithm_event(date, start_time, end_time, venue) message = "" if result == "success": event = Event_info.objects.select_related( @@ -316,7 +314,7 @@ def edit_event(request, event_id): event.end_time = end_time event.event_poster = event_poster event.details = desc - event.status = 'confirmed' + event.status = "confirmed" event.save() # e = Event_info.objects.filter(id=event_id).update(club = club_name, event_name=event_name, incharge=incharge, venue = venue, date =date, start_time=start_time , end_time = end_time ,event_poster = event_poster , details = desc) message += "Your form has been dispatched for further process" @@ -488,11 +486,7 @@ def studentsClubMembers(request): print(club_filter) try: # students = ExtraInfo.objects.all().filter(user_type="student").filter(id__startswith=current_value) - students = ( - Club_member.objects.select_related() - .all() - .filter(club=club_filter) - ) + students = Club_member.objects.select_related().all().filter(club=club_filter) students = serializers.serialize("json", students) return HttpResponse(students) except Exception as e: @@ -743,8 +737,7 @@ def registration_form(request): try: # getting form data info = ( - Student.objects.select_related( - "id", "id__user", "id__department") + Student.objects.select_related("id", "id__user", "id__department") .get(id__user=request.user) .cpi ) @@ -920,11 +913,9 @@ def return_content(request, roll, name, desig, club__, student_clubs, notificati ) try: - form_name = Form_available.objects.get( - roll=request.user.username).form_name + form_name = Form_available.objects.get(roll=request.user.username).form_name logger.info(f"{form_name} MKNCjncknisncs") - status = Form_available.objects.get( - roll=request.user.username).status + status = Form_available.objects.get(roll=request.user.username).status except Exception as e: forms = Form_available.objects.all() for form in forms: @@ -1078,8 +1069,7 @@ def gymkhana(request): roll = request.user name = request.user.first_name + "_" + request.user.last_name designations = list( - HoldsDesignation.objects.select_related( - "user", "working", "designation") + HoldsDesignation.objects.select_related("user", "working", "designation") .all() .filter(working=request.user) .values_list("designation") @@ -1114,7 +1104,9 @@ def gymkhana(request): return render( request, "gymkhanaModule/gymkhana.html", - return_content(request, roll, name, roll_, club__, student_clubs, notifications), + return_content( + request, roll, name, roll_, club__, student_clubs, notifications + ), ) @@ -1391,44 +1383,73 @@ def club_report(request): def change_head(request): if request.method == "POST": club = request.POST.get("club") - co_ordinator = request.POST.get('co') - co_coordinator = request.POST.get('coco') + co_ordinator = request.POST.get("co") + co_coordinator = request.POST.get("coco") - desc = "co-ordinator and co co-ordinator changed on " + \ - str(timezone.now()) + desc = "co-ordinator and co co-ordinator changed on " + str(timezone.now()) message = "" club_info = Club_info.objects.get(club_name=club) if co_ordinator: check = Club_member.objects.filter( - club_id=club, member_id=co_ordinator).exists() + club_id=club, member_id=co_ordinator + ).exists() if check == False: - return HttpResponse(json.dumps({'status': 'error', 'message': 'Selected student is not a member of the club'})) + return HttpResponse( + json.dumps( + { + "status": "error", + "message": "Selected student is not a member of the club", + } + ) + ) co_ordinator_student = Student.objects.get(id_id=co_ordinator) old_co_ordinator = club_info.co_ordinator_id club_info.co_ordinator_id = co_ordinator_student - new_co_ordinator = HoldsDesignation(user=User.objects.get(username=co_ordinator), working=User.objects.get( - username=co_ordinator), designation=Designation.objects.get(name="co-ordinator")) + new_co_ordinator = HoldsDesignation( + user=User.objects.get(username=co_ordinator), + working=User.objects.get(username=co_ordinator), + designation=Designation.objects.get(name="co-ordinator"), + ) new_co_ordinator.save() - old_co_ordinator_obj = HoldsDesignation.objects.select_related('user', 'working', 'designation').filter( - user__username=old_co_ordinator, designation=Designation.objects.get(name="co-ordinator")) + old_co_ordinator_obj = HoldsDesignation.objects.select_related( + "user", "working", "designation" + ).filter( + user__username=old_co_ordinator, + designation=Designation.objects.get(name="co-ordinator"), + ) old_co_ordinator_obj.delete() message += "Successfully changed co-ordinator !!!" if co_coordinator: check = Club_member.objects.filter( - club_id=club, member_id=co_coordinator).exists() + club_id=club, member_id=co_coordinator + ).exists() if check == False: - return HttpResponse(json.dumps({'status': 'error', 'message': 'Selected student is not a member of the club'})) + return HttpResponse( + json.dumps( + { + "status": "error", + "message": "Selected student is not a member of the club", + } + ) + ) co_coordinator_student = Student.objects.get(id_id=co_coordinator) old_co_coordinator = club_info.co_coordinator_id club_info.co_coordinator_id = co_coordinator_student - new_co_coordinator = HoldsDesignation(user=User.objects.get(username=co_coordinator), working=User.objects.get( - username=co_coordinator), designation=Designation.objects.get(name="co co-ordinator")) + new_co_coordinator = HoldsDesignation( + user=User.objects.get(username=co_coordinator), + working=User.objects.get(username=co_coordinator), + designation=Designation.objects.get(name="co co-ordinator"), + ) new_co_coordinator.save() - old_co_coordinator_obj = HoldsDesignation.objects.select_related('user', 'working', 'designation').filter( - user__username=old_co_coordinator, designation=Designation.objects.get(name="co co-ordinator")) + old_co_coordinator_obj = HoldsDesignation.objects.select_related( + "user", "working", "designation" + ).filter( + user__username=old_co_coordinator, + designation=Designation.objects.get(name="co co-ordinator"), + ) old_co_coordinator_obj.delete() message += " Successfully changed co-coordinator !!!" @@ -1436,8 +1457,8 @@ def change_head(request): club_info.save() content = { - 'status': "success", - 'message': message, + "status": "success", + "message": message, } content = json.dumps(content) @@ -1480,8 +1501,7 @@ def new_session(request): end_time = request.POST.get("end_time") desc = request.POST.get("d_d") club_name = coordinator_club(request) - result = conflict_algorithm_session( - date, start_time, end_time, venue) + result = conflict_algorithm_session(date, start_time, end_time, venue) message = "" getstudents = ExtraInfo.objects.select_related("user", "department").filter( user_type="student" @@ -1556,8 +1576,7 @@ def new_event(request): end_time = request.POST.get("end_time") desc = request.POST.get("d_d") club_name = coordinator_club(request) - result = conflict_algorithm_event( - date, start_time, end_time, venue) + result = conflict_algorithm_event(date, start_time, end_time, venue) message = "" getstudents = ExtraInfo.objects.select_related("user", "department").filter( user_type="student" @@ -1690,15 +1709,13 @@ def club_approve(request): club_info.created_on = timezone.now() club_info.save() - user_name1 = get_object_or_404( - User, username=club_info.co_ordinator) + user_name1 = get_object_or_404(User, username=club_info.co_ordinator) extra1 = get_object_or_404( ExtraInfo, id=club_info.co_ordinator, user=user_name1 ) student1 = get_object_or_404(Student, id=extra1) - user_name2 = get_object_or_404( - User, username=club_info.co_coordinator) + user_name2 = get_object_or_404(User, username=club_info.co_coordinator) extra2 = get_object_or_404( ExtraInfo, id=club_info.co_coordinator, user=user_name2 ) @@ -1808,8 +1825,7 @@ def cancel(request): extra1 = get_object_or_404(ExtraInfo, id=info[0], user=user_name) student = get_object_or_404(Student, id=extra1) - club_member = get_object_or_404( - Club_member, club=user[1], member=student) + club_member = get_object_or_404(Club_member, club=user[1], member=student) club_member.delete() messages.success(request, "Successfully deleted !!!") @@ -2136,7 +2152,8 @@ def budget_approve(request): for club in first_words: print(club) club_budget_list = Club_budget.objects.filter( - club_id=club, status="open") # Ensure status is open + club_id=club, status="open" + ) # Ensure status is open print(club_budget) for single_club in club_budget_list: single_club.status = "confirmed" @@ -2144,9 +2161,7 @@ def budget_approve(request): # single_club.alloted_budget = single_club.alloted_budget + single_club.budget_amt single_club.save() # club_budget.save() - messages.success( - request, f"Successfully budget approved for club." - ) + messages.success(request, f"Successfully budget approved for club.") return redirect("/gymkhana/") @@ -2170,13 +2185,10 @@ def budget_reject(request): for club in first_words: print(club) - club_budget = Club_budget.objects.get( - club_id=club, status="open" - ) + club_budget = Club_budget.objects.get(club_id=club, status="open") club_budget.status = "rejected" club_budget.save() - messages.success( - request, f"Successfully budget rejected for club.") + messages.success(request, f"Successfully budget rejected for club.") return redirect("/gymkhana/") @@ -2545,6 +2557,7 @@ def del_club(request): return redirect("/gymkhana/") + def approve_events(request): selected_ids = request.POST.get("ids") @@ -2559,7 +2572,12 @@ def approve_events(request): event.status = "confirmed" event.save() except ObjectDoesNotExist: - return JsonResponse({"status": "error", "message": f"Event with ID {event_id} does not exist"}) + return JsonResponse( + { + "status": "error", + "message": f"Event with ID {event_id} does not exist", + } + ) return JsonResponse({"status": "success"}) except Exception as e: @@ -2567,8 +2585,8 @@ def approve_events(request): def update_club_name(request): - club_id = request.POST.get('club_id') - new_name = request.POST.get('new_name') + club_id = request.POST.get("club_id") + new_name = request.POST.get("new_name") if club_id and new_name: try: @@ -2594,73 +2612,87 @@ def update_club_name(request): status="open", description=description, activity_calender=activity_calender, - category=category - - + category=category, ) new_club.save() - return JsonResponse({'status': 'success'}) + return JsonResponse({"status": "success"}) except Club_info.DoesNotExist: - return JsonResponse({'status': 'error', 'message': 'Club not found'}) - - - + return JsonResponse({"status": "error", "message": "Club not found"}) + + @csrf_exempt def update_budget_amount(request): print("inside function") - if request.method == 'POST': - budget_id = request.POST.get('budget_id') - req_id=request.POST.get('req_id') - + if request.method == "POST": + budget_id = request.POST.get("budget_id") + req_id = request.POST.get("req_id") + print(budget_id) print(req_id) # Fetch the budget object - + budget = Club_budget.objects.get(id=budget_id) - if req_id=="spent": - new_budget = float(request.POST.get('new_budget')) # convert new_budget to float + if req_id == "spent": + new_budget = float( + request.POST.get("new_budget") + ) # convert new_budget to float - # Fetch the budget object + # Fetch the budget object budget = Club_budget.objects.get(id=budget_id) - # Update the budget amount + # Update the budget amount if new_budget > budget.budget_amt: - return JsonResponse({'status': 'error', 'message': 'Spent amount cannot be greater than available amount!'}) + return JsonResponse( + { + "status": "error", + "message": "Spent amount cannot be greater than available amount!", + } + ) budget.budget_amt = budget.budget_amt - new_budget budget.save() - + else: - # Update the budget amount - new_budget = request.POST.get('new_budget') + # Update the budget amount + new_budget = request.POST.get("new_budget") budget.budget_amt = new_budget budget.save() - # Return a success response - return JsonResponse({'status': 'success', 'message': 'Budget amount updated successfully'}) + # Return a success response + return JsonResponse( + {"status": "success", "message": "Budget amount updated successfully"} + ) # Return an error response if not a POST request - return JsonResponse({'status': 'error', 'message': 'Invalid request'}) - + return JsonResponse({"status": "error", "message": "Invalid request"}) @csrf_exempt def update_spent_amount(request): - if request.method == 'POST': - budget_id = request.POST.get('budget_id') - new_budget = float(request.POST.get('new_budget')) # convert new_budget to float + if request.method == "POST": + budget_id = request.POST.get("budget_id") + new_budget = float( + request.POST.get("new_budget") + ) # convert new_budget to float # Fetch the budget object budget = Club_budget.objects.get(id=budget_id) # Update the budget amount if new_budget > budget.budget_amt: - return JsonResponse({'status': 'error', 'message': 'Spent amount cannot be greater than available amount!'}) + return JsonResponse( + { + "status": "error", + "message": "Spent amount cannot be greater than available amount!", + } + ) budget.budget_amt = budget.budget_amt - new_budget budget.save() # Return a success response - return redirect('/gymkhana/') + return redirect("/gymkhana/") # Return an error response if not a POST request - return JsonResponse({'status': 'error', 'message': 'Invalid request'}) \ No newline at end of file + return JsonResponse({"status": "error", "message": "Invalid request"}) + + diff --git a/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py new file mode 100644 index 000000000..41904d1a8 --- /dev/null +++ b/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2025-02-10 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('programme_curriculum', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='batch', + name='year', + field=models.PositiveIntegerField(default=2025), + ), + migrations.AlterField( + model_name='programme', + name='programme_begin_year', + field=models.PositiveIntegerField(default=2025), + ), + ] diff --git a/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py new file mode 100644 index 000000000..97a1141f4 --- /dev/null +++ b/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2025-02-10 16:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('scholarships', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='previous_winner', + name='year', + field=models.IntegerField(default=2025), + ), + ] From a6c3d366b81ff9fec305f273c7ba5c532ded952e Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Fri, 21 Mar 2025 00:09:05 +0530 Subject: [PATCH 06/11] feat(KD SIR Feature: free members in current time based on events) --- FusionIIIT/applications/gymkhana/api/views.py | 33 +++++++++++++++++++ FusionIIIT/applications/gymkhana/urls.py | 2 ++ 2 files changed, 35 insertions(+) diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index bdc29fc50..cc2cb2120 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -1418,3 +1418,36 @@ def put(self, request): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +class FreeMembersForClubAPIView(APIView): + def get(self, request): + club_id = request.data.get('club_id') # Use query_params for GET request + if not club_id: + return Response({"error": "Club id is required."}, status=status.HTTP_400_BAD_REQUEST) + + try: + # Get upcoming events for the club + events = Event_info.objects.filter(club_id=club_id, start_date__gte =timezone.now().date()) + + # Map incharge members to their events + incharge_map = {} + for event in events: + if event.incharge: # Ensure incharge is not None + incharge_map[str(event.incharge)] = event.event_name + + # Get all club members + members = Club_member.objects.filter(club_id=club_id) + + # Prepare the response data + response_data = [] + for memb in members: + roll_no = str(memb.member_id) # Ensure same type as incharge_map keys + response_data.append({ + "roll_no": roll_no, + "event_name": incharge_map.get(roll_no, None) # Set event_name or None + }) + + return Response(response_data, status=status.HTTP_200_OK) + + except Exception as e: + return Response({"error": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 154042414..f92b58028 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -14,6 +14,7 @@ DeleteClubBudgetAPIView, EventDeleteAPIView, EventUpdateAPIView, + FreeMembersForClubAPIView, SessionUpdateAPIView, UpdateClubBudgetAPIView, UpdateClubNameAPIView, @@ -287,4 +288,5 @@ url(r"^api/update_budget/$", UpdateBudgetAPIView.as_view(), name="update budget"), url(r"^fest/$" , FestListView.as_view(), name="fest"), url(r'^api/new_fest/$', NewFestAPIView.as_view(), name='new_fest'), + url(r'^api/event_allocation/$', FreeMembersForClubAPIView.as_view(), name='event allocation'), ] From c5611167fb3e5d1e119edb01f6154a8565589ffc Mon Sep 17 00:00:00 2001 From: Sayali Kadam <22bcs122@iiitdmj.ac.in> Date: Sat, 22 Mar 2025 17:19:10 +0530 Subject: [PATCH 07/11] added newsletter backend --- .../applications/gymkhana/api/serializers.py | 12 +- FusionIIIT/applications/gymkhana/api/views.py | 264 +++++++++++++++++- .../gymkhana/migrations/0009_eventinput.py | 23 ++ FusionIIIT/applications/gymkhana/models.py | 9 +- FusionIIIT/applications/gymkhana/urls.py | 6 + 5 files changed, 311 insertions(+), 3 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index dbe74f607..d511c2cf0 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -3,7 +3,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from applications.gymkhana.models import Club_info,Session_info,Event_info -from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Fest,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Fest,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition, EventInput # class Voting_choicesSerializer(serializers.ModelSerializer): # class Meta: @@ -103,3 +103,13 @@ class FestSerializer(serializers.ModelSerializer): class Meta: model=Fest fields= ['id', 'name', 'category', 'description', 'date', 'link'] + +class EventInputSerializer(serializers.ModelSerializer): + # Use event name for dropdown-like functionality + event = serializers.SlugRelatedField( + queryset=Event_info.objects.all(), + slug_field='id') + + class Meta: + model = EventInput + fields = ['id', 'event', 'description','images'] \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index cc2cb2120..0cd9a49d6 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -1,7 +1,7 @@ import genericpath import json import tempfile -from datetime import datetime +from datetime import datetime, timedelta from venv import logger from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication @@ -47,8 +47,17 @@ Budget_CommentsSerializer, ClubPositionSerializer, FestSerializer, + EventInputSerializer ) +from io import BytesIO +from django.http import FileResponse +from reportlab.lib.pagesizes import letter +from reportlab.lib import colors +from reportlab.platypus import ( + SimpleDocTemplate, Paragraph, Spacer, Image, HRFlowable, PageBreak +) +from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from django.contrib.auth.models import User from applications.gymkhana.views import * from rest_framework import generics @@ -1451,3 +1460,256 @@ def get(self, request): except Exception as e: return Response({"error": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + +class CoordinatorEventsAPIView(APIView): + """ + API View to fetch events for clubs where the given person (by roll number) is a coordinator. + Filters by accepted events and those in the current month. + """ + + def post(self, request): + # Extract roll number from the request data + roll_number = request.data.get("roll_number") + if not roll_number: + return Response( + {"error": "Roll number is required."}, + status=status.HTTP_400_BAD_REQUEST, + ) + + try: + clubs = Club_info.objects.filter(co_ordinator=roll_number) + # Get the current month and year + current_month = datetime.datetime.now().month + current_year = datetime.datetime.now().year + + # Fetch events associated with those clubs, with status 'accepted' and within the same month + events = Event_info.objects.filter( + club__in=clubs, + # status="Accepted", # Replace with your actual status choice + # start_date__year=current_year, + # start_date__month=current_month, + ) + + # Serialize and return the events + serializer = event_infoserializer(events, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) + + except Student.DoesNotExist: + return Response( + {"error": "Student not found with the given roll number."}, + status=status.HTTP_404_NOT_FOUND, + ) + +class EventInputAPIView(APIView): + def get(self, request): + """ + Returns a list of all Event_info objects (dropdown options). + """ + events = Event_info.objects.all() + events_data = [{"id": event.id, "name": event.event_name} for event in events] # Adjust fields as needed + return Response(events_data, status=status.HTTP_200_OK) + + def post(self, request): + """ + Creates a new EventInput instance. + """ + # print(request.data["event"]) + # request.data["images"]=None + print(request.data) + serializer = EventInputSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +#helper +def add_page_decorations(canvas, doc): + canvas.saveState() + page_num = canvas.getPageNumber() + canvas.setFont('Helvetica', 10) + canvas.drawCentredString(letter[0] / 2.0, 20, f"Page {page_num}") + canvas.restoreState() + +class NewsletterPDFAPIView(APIView): + def get(self, request): + # Determine timeframe filter based on query parameter + timeframe = request.GET.get('timeframe', '').lower() + now = timezone.now() + if timeframe == 'weekly': + time_threshold = now - timedelta(weeks=1) + elif timeframe == 'monthly': + time_threshold = now - timedelta(days=30) + elif timeframe == '6 months': + time_threshold = now - timedelta(days=182) # Approximation for half a year + else: + time_threshold = None + print(time_threshold) + # Fetch all unique clubs + clubs = Event_info.objects.values_list('club', flat=True).distinct() + has_events = False + for club in clubs: + club_events = EventInput.objects.filter(event__club=club) + if time_threshold: + club_events = club_events.filter(event__end_date__range=(time_threshold, now)) + if club_events.exists(): + has_events = True + break + + if not has_events: + return Response({"message": "No events found for the selected timeframe."}, status=status.HTTP_404_NOT_FOUND) + + # Create an in-memory file + buffer = BytesIO() + doc = SimpleDocTemplate(buffer, pagesize=letter) + + # Get the default style sheet and create custom styles + styles = getSampleStyleSheet() + story = [] + + # --- Banner Section --- + banner_path = "path/to/your/banner.jpg" # Update this path to your banner image + try: + banner = Image(banner_path, width=letter[0], height=150) + story.append(banner) + except Exception: + pass + + story.append(Spacer(1, 20)) + + # Catchy Title and Tagline + title_style = ParagraphStyle( + name='TitleStyle', + parent=styles['Title'], + fontName='Helvetica-Bold', + fontSize=26, + leading=30, + alignment=1, + textColor=colors.darkblue + ) + tagline_style = ParagraphStyle( + name='Tagline', + parent=styles['BodyText'], + fontName='Helvetica-Oblique', + fontSize=14, + leading=18, + alignment=1, + textColor=colors.darkgray + ) + + story.append(Paragraph("IIITDM Jabalpur Gymkhana Newsletter", title_style)) + story.append(Spacer(1, 10)) + story.append(Paragraph("Stay tuned for the latest happenings and exclusive updates!", tagline_style)) + story.append(Spacer(1, 30)) + + # Introductory paragraph + intro_style = ParagraphStyle( + name='Intro', + parent=styles['BodyText'], + fontSize=12, + leading=16, + alignment=1, + textColor=colors.black + ) + intro_text = ( + "Welcome to our monthly newsletter where we bring you the most exciting events from various clubs. " + "Dive into details, get inspired, and mark your calendars for a memorable experience!" + ) + story.append(Paragraph(intro_text, intro_style)) + story.append(Spacer(1, 40)) + + # --- Newsletter Content --- + club_header_style = ParagraphStyle( + name='ClubHeader', + fontName='Helvetica-Bold', + fontSize=18, + leading=22, + textColor=colors.darkred, + backColor=colors.whitesmoke, + spaceAfter=10, + borderPadding=(5, 5, 5, 5) + ) + + event_heading_style = ParagraphStyle( + name='EventHeading', + fontName='Helvetica-Bold', + fontSize=14, + leading=18, + textColor=colors.darkgreen + ) + + body_text_style = ParagraphStyle( + name='BodyText', + parent=styles['BodyText'], + fontSize=12, + leading=15, + textColor=colors.black + ) + + italic_style = ParagraphStyle( + name='Italic', + parent=styles['BodyText'], + fontName='Helvetica-Oblique', + fontSize=12, + leading=15, + textColor=colors.gray + ) + + for club in clubs: + story.append(Paragraph(f"Club: {club}", club_header_style)) + story.append(Spacer(1, 20)) + + club_events = EventInput.objects.filter(event__club=club) + if time_threshold: + club_events = club_events.filter(event__end_date__range=(time_threshold, now)) + + for event in club_events: + event_info = event.event + + story.append(HRFlowable(width="100%", thickness=1, color=colors.lightgrey)) + story.append(Spacer(1, 10)) + story.append(Paragraph("Event Details", event_heading_style)) + story.append(Spacer(1, 10)) + + story.append(Paragraph(f"Event: {event_info.event_name}", body_text_style)) + story.append(Spacer(1, 10)) + + story.append(Paragraph( + f"Start Date: {event_info.start_date.strftime('%B %d, %Y')}", + body_text_style)) + story.append(Spacer(1, 10)) + + story.append(Paragraph( + f"Start Time: {event_info.start_time.strftime('%I:%M %p')}", + body_text_style)) + story.append(Spacer(1, 10)) + + story.append(Paragraph( + f"Venue: {event_info.venue}", + body_text_style)) + story.append(Spacer(1, 10)) + + story.append(Paragraph("Description:", event_heading_style)) + story.append(Paragraph(f"{event.description}", body_text_style)) + story.append(Spacer(1, 10)) + + if event.images: + image_path = event.images.path + try: + story.append(Image(image_path, width=200, height=150)) + except Exception: + story.append(Paragraph("[Image could not be loaded]", body_text_style)) + else: + story.append(Paragraph("[Image Placeholder]", body_text_style)) + + story.append(Spacer(1, 10)) + story.append(Paragraph( + "Additional Information: Stay tuned for more updates and behind-the-scenes insights!", + italic_style)) + story.append(Spacer(1, 30)) + + story.append(PageBreak()) + + doc.build(story, onFirstPage=add_page_decorations, onLaterPages=add_page_decorations) + buffer.seek(0) + + return FileResponse(buffer, as_attachment=True, filename="newsletter.pdf") \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py b/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py new file mode 100644 index 000000000..30655a21b --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2025-03-22 17:17 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0008_auto_20250217_1709'), + ] + + operations = [ + migrations.CreateModel( + name='EventInput', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(max_length=500)), + ('images', models.ImageField(null=True, upload_to='gymkhana/event_images')), + ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.event_info')), + ], + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 9869c5b5a..82173277c 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -639,4 +639,11 @@ class Meta: def _str_(self): return f"{self.club.club_name} - {self.name} - {self.position}" class Meta: - db_table = "ClubPosition" \ No newline at end of file + db_table = "ClubPosition" + +class EventInput(models.Model): + event=models.ForeignKey(Event_info,on_delete=models.CASCADE) + description=models.TextField(max_length=500) + images=models.ImageField(upload_to="gymkhana/event_images",null=True) + def _str_(self): + return str(self.event) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index f92b58028..cb42a58ba 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -62,6 +62,9 @@ AddClubPositionAPIView, ListClubPositionAPIView, NewFestAPIView, + CoordinatorEventsAPIView, + EventInputAPIView, + NewsletterPDFAPIView ) from . import views from rest_framework.authtoken.views import obtain_auth_token @@ -289,4 +292,7 @@ url(r"^fest/$" , FestListView.as_view(), name="fest"), url(r'^api/new_fest/$', NewFestAPIView.as_view(), name='new_fest'), url(r'^api/event_allocation/$', FreeMembersForClubAPIView.as_view(), name='event allocation'), + url(r'^api/coordinator_events/$', CoordinatorEventsAPIView.as_view(), name='coordinator_events'), + url(r'^api/coordinator_eventsinput/$', EventInputAPIView.as_view(), name='coordinator_eventsinput'), + url(r'^api/newsletter_pdf/$', NewsletterPDFAPIView.as_view(), name='newsletter_pdf'), ] From 3cf777a066ed03d5199b5219b909b0536f19c6de Mon Sep 17 00:00:00 2001 From: Sayali Kadam <22bcs122@iiitdmj.ac.in> Date: Sun, 23 Mar 2025 01:41:10 +0530 Subject: [PATCH 08/11] added backend for report --- .../applications/gymkhana/api/serializers.py | 9 ++- FusionIIIT/applications/gymkhana/api/views.py | 73 ++++++++++++++++++- .../gymkhana/migrations/0010_eventreport.py | 34 +++++++++ FusionIIIT/applications/gymkhana/models.py | 18 ++++- FusionIIIT/applications/gymkhana/urls.py | 4 + 5 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index d511c2cf0..36d06dedc 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -3,7 +3,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from applications.gymkhana.models import Club_info,Session_info,Event_info -from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Fest,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition, EventInput +from applications.gymkhana.models import Club_member,Club_budget,Club_report,Fest_budget,Fest,Registration_form,Budget,Budget_Comments,Event_Comments,Achievements,ClubPosition, EventInput, EventReport # class Voting_choicesSerializer(serializers.ModelSerializer): # class Meta: @@ -112,4 +112,9 @@ class EventInputSerializer(serializers.ModelSerializer): class Meta: model = EventInput - fields = ['id', 'event', 'description','images'] \ No newline at end of file + fields = ['id', 'event', 'description','images'] + +class EventReportSerializer(serializers.ModelSerializer): + class Meta: + model = EventReport + fields = '__all__' diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 0cd9a49d6..b2b44d113 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -47,7 +47,8 @@ Budget_CommentsSerializer, ClubPositionSerializer, FestSerializer, - EventInputSerializer + EventInputSerializer, + EventReportSerializer ) from io import BytesIO @@ -1712,4 +1713,72 @@ def get(self, request): doc.build(story, onFirstPage=add_page_decorations, onLaterPages=add_page_decorations) buffer.seek(0) - return FileResponse(buffer, as_attachment=True, filename="newsletter.pdf") \ No newline at end of file + return FileResponse(buffer, as_attachment=True, filename="newsletter.pdf") + +class EventReportAPIView(APIView): + def post(self, request): + data = request.data.copy() + event_id = data.get("event") + + if isinstance(event_id, str) and event_id.isdigit(): + event_id = int(event_id) + + try: + event_instance = Event_info.objects.get(pk=event_id) + data["event"] = event_instance.pk # Assigning the ID, not the instance + except Event_info.DoesNotExist: + return Response({"error": "Invalid event ID"}, status=status.HTTP_400_BAD_REQUEST) + + serializer = EventReportSerializer(data=data) + if serializer.is_valid(): + event_report = serializer.save() + + # Generate PDF using ReportLab + buffer = BytesIO() + doc = SimpleDocTemplate(buffer, pagesize=letter) + elements = [] + + styles = getSampleStyleSheet() + title_style = ParagraphStyle( + "TitleStyle", + parent=styles["Title"], + fontSize=16, + textColor=colors.darkblue, + alignment=1, # Center alignment + ) + normal_style = styles["Normal"] + + elements.append(Paragraph(f"Event Report for {event_instance.event_name}", title_style)) + elements.append(HRFlowable(width="100%", thickness=1, color=colors.black)) + elements.append(Spacer(1, 12)) + elements.append(Paragraph(f"Club: {event_instance.club}", normal_style)) + elements.append(Paragraph(f"Venue: {event_report.venue}", normal_style)) + elements.append(Paragraph(f"Incharge: {event_report.incharge}", normal_style)) + elements.append(Paragraph(f"Start Date: {event_report.start_date}", normal_style)) + elements.append(Paragraph(f"End Date: {event_report.end_date}", normal_style)) + elements.append(Paragraph(f"Start Time: {event_report.start_time}", normal_style)) + elements.append(Paragraph(f"End Time: {event_report.end_time}", normal_style)) + elements.append(Paragraph(f"Budget: {event_report.event_budget}", normal_style)) + elements.append(Paragraph(f"Special Announcement: {event_report.special_announcement or 'None'}", normal_style)) + elements.append(PageBreak()) + + doc.build(elements) + buffer.seek(0) + + file_name = f"event_report_{event_report.id}.pdf" + event_report.report_pdf.save(file_name, ContentFile(buffer.getvalue()), save=True) + + return Response(serializer.data, status=status.HTTP_201_CREATED) + + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class EventReportListAPIView(APIView): + def get(self, request): + club_id = request.query_params.get("club") + if not club_id: + return Response({"error": "Club ID is required"}, status=status.HTTP_400_BAD_REQUEST) + print(club_id) + events = Event_info.objects.filter(club=club_id) + print(events) + event_reports = EventReport.objects.filter(event_id__in=events) + serializer = EventReportSerializer(event_reports, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py b/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py new file mode 100644 index 000000000..14cfa47a6 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py @@ -0,0 +1,34 @@ +# Generated by Django 3.1.5 on 2025-03-22 23:28 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0009_eventinput'), + ] + + operations = [ + migrations.CreateModel( + name='EventReport', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(blank=True, null=True)), + ('venue', models.CharField(max_length=100)), + ('incharge', models.CharField(max_length=50)), + ('start_date', models.DateField()), + ('end_date', models.DateField()), + ('start_time', models.TimeField()), + ('end_time', models.TimeField()), + ('event_budget', models.DecimalField(decimal_places=2, max_digits=10)), + ('special_announcement', models.TextField(blank=True, null=True)), + ('report_pdf', models.FileField(blank=True, null=True, upload_to='event_reports/')), + ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.event_info')), + ], + options={ + 'db_table': 'EventReport', + }, + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 82173277c..06c77c1a3 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -646,4 +646,20 @@ class EventInput(models.Model): description=models.TextField(max_length=500) images=models.ImageField(upload_to="gymkhana/event_images",null=True) def _str_(self): - return str(self.event) \ No newline at end of file + return str(self.event) + +class EventReport(models.Model): + event = models.ForeignKey(Event_info, on_delete=models.CASCADE) + description = models.TextField(null=True, blank=True) + venue = models.CharField(max_length=100, null=False) + incharge = models.CharField(max_length=50, null=False) + start_date = models.DateField(null=False) + end_date = models.DateField(null=False) + start_time = models.TimeField(null=False) + end_time = models.TimeField(null=False) + event_budget = models.DecimalField(max_digits=10, decimal_places=2, null=False) + special_announcement = models.TextField(null=True, blank=True) + report_pdf = models.FileField(upload_to='event_reports/', null=True, blank=True) + + class Meta: + db_table = "EventReport" \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index cb42a58ba..018f73e21 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -26,6 +26,8 @@ RejectBudgetAPIView, UpdateEventAPIView, FestListView, + EventReportListAPIView, + EventReportAPIView, ) from applications.gymkhana.api.views import ( clubname, @@ -295,4 +297,6 @@ url(r'^api/coordinator_events/$', CoordinatorEventsAPIView.as_view(), name='coordinator_events'), url(r'^api/coordinator_eventsinput/$', EventInputAPIView.as_view(), name='coordinator_eventsinput'), url(r'^api/newsletter_pdf/$', NewsletterPDFAPIView.as_view(), name='newsletter_pdf'), + url(r'^api/event_report_list/$', EventReportListAPIView.as_view(), name='event_report_list'), + url(r'^api/add_event_report/$', EventReportAPIView.as_view(), name='add_event_report') ] From 4e38b9cd3ab6bd225bbef030a15718664e582804 Mon Sep 17 00:00:00 2001 From: Sayali Kadam <22bcs122@iiitdmj.ac.in> Date: Sun, 23 Mar 2025 11:04:05 +0530 Subject: [PATCH 09/11] viewing report logic added --- FusionIIIT/applications/gymkhana/api/views.py | 13 ++++++++++++- FusionIIIT/applications/gymkhana/urls.py | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index b2b44d113..82e1b48c0 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -1781,4 +1781,15 @@ def get(self, request): print(events) event_reports = EventReport.objects.filter(event_id__in=events) serializer = EventReportSerializer(event_reports, many=True) - return Response(serializer.data, status=status.HTTP_200_OK) \ No newline at end of file + return Response(serializer.data, status=status.HTTP_200_OK) +class EventReportPDFView(APIView): + def get(self, request, report_id): + try: + event_report = EventReport.objects.get(pk=report_id) + if not event_report.report_pdf: + return Response({"error": "No PDF report available for this event"}, status=status.HTTP_404_NOT_FOUND) + + return FileResponse(event_report.report_pdf.open('rb'), content_type='application/pdf') + + except EventReport.DoesNotExist: + return Response({"error": "Event report not found"}, status=status.HTTP_404_NOT_FOUND) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 018f73e21..013d3490d 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -28,6 +28,7 @@ FestListView, EventReportListAPIView, EventReportAPIView, + EventReportPDFView ) from applications.gymkhana.api.views import ( clubname, @@ -298,5 +299,6 @@ url(r'^api/coordinator_eventsinput/$', EventInputAPIView.as_view(), name='coordinator_eventsinput'), url(r'^api/newsletter_pdf/$', NewsletterPDFAPIView.as_view(), name='newsletter_pdf'), url(r'^api/event_report_list/$', EventReportListAPIView.as_view(), name='event_report_list'), - url(r'^api/add_event_report/$', EventReportAPIView.as_view(), name='add_event_report') + url(r'^api/add_event_report/$', EventReportAPIView.as_view(), name='add_event_report'), + url(r'^api/event_report_pdf/(?P\d+)/$', EventReportPDFView.as_view(), name='event_report_pdf') ] From 13876b83b69135d5956f338ff4e2e6b09b77a6d2 Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Sun, 23 Mar 2025 20:09:02 +0530 Subject: [PATCH 10/11] feat(deploy V1): Most required functions are done we need to work on feedback --- FusionIIIT/Fusion/settings/development.py | 2 +- .../applications/gymkhana/api/serializers.py | 2 +- FusionIIIT/applications/gymkhana/api/views.py | 67 ++++++++++++++----- .../migrations/0011_auto_20250323_1711.py | 48 +++++++++++++ FusionIIIT/applications/gymkhana/models.py | 58 +++++++++++----- FusionIIIT/applications/gymkhana/urls.py | 7 +- 6 files changed, 147 insertions(+), 37 deletions(-) create mode 100644 FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py diff --git a/FusionIIIT/Fusion/settings/development.py b/FusionIIIT/Fusion/settings/development.py index 63587a11f..ad928f103 100644 --- a/FusionIIIT/Fusion/settings/development.py +++ b/FusionIIIT/Fusion/settings/development.py @@ -12,7 +12,7 @@ 'NAME': 'fusionlab', 'HOST': os.environ.get("DB_HOST", default='localhost'), 'USER': 'fusion_admin', - 'PASSWORD': 'hello123', + 'PASSWORD': 'hello123' } } diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 36d06dedc..08aa6b0fa 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -81,7 +81,7 @@ class Meta: class BudgetSerializer(serializers.ModelSerializer): class Meta: model = Budget - fields = ['id', 'club', 'budget_for', 'budget_amt', 'budget_file', 'description', 'status', 'remarks'] + fields = ['id', 'club', 'budget_for', 'budget_requested', 'budget_allocated', 'budget_file', 'description', 'status', 'remarks', 'budget_comment'] class AchievementsSerializer(serializers.ModelSerializer): class Meta: model = Achievements diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 82e1b48c0..0b0c9c80e 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -338,9 +338,13 @@ def post(self, request): class AddMemberToClub(APIView): def post(self, request): + member = request.data.get("member") + club = request.data.get("club") + if Club_member.objects.filter(member=member, club=club).exists(): + return Response({"error": "Member has already applied to this club."}, status=status.HTTP_400_BAD_REQUEST) data = { - "member": request.data.get("member"), - "club": request.data.get("club"), + "member": member, + "club": club, "description": request.data.get("description"), "status": "open", } @@ -351,6 +355,7 @@ def post(self, request): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class ClubMemberAPIView(APIView): def post(self, request): club_member_id = request.data.get("club_name") @@ -1171,19 +1176,19 @@ def put(self, request): class CounsellorApproveBudgetAPIView(APIView): def put(self, request): - budget_id = request.data.get("id") + budget_id = request.data.get('id') budget = get_object_or_404(Budget, id=budget_id) - if budget.status != "COUNSELLOR": - return Response( - {"error": "Budget is not under Counsellor review."}, - status=status.HTTP_400_BAD_REQUEST, - ) - budget.status = "DEAN" - budget.save() - return Response( - {"message": "Budget status changed to 'Dean Review'."}, - status=status.HTTP_200_OK, - ) + if budget.status != 'COUNSELLOR' and budget.status != 'REREVIEW': + return Response({"error": "Budget is not under Counsellor review."}, status=status.HTTP_400_BAD_REQUEST) + if budget.status == 'REREVIEW': + budget.status = 'ACCEPT' + else: + budget.status = 'DEAN' + serializer = BudgetSerializer(budget, data=request.data, partial=True) + if serializer.is_valid(): + serializer.save(status=budget.status) + return Response({"message": "Budget updated and status changed"}, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class DeanApproveBudgetAPIView(APIView): @@ -1202,6 +1207,19 @@ def put(self, request): status=status.HTTP_200_OK, ) +class DeanReviewBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + + if budget.status != 'DEAN': + return Response({"error": "Budget is not under Dean review."}, status=status.HTTP_400_BAD_REQUEST) + + serializer = BudgetSerializer(budget, data=request.data, partial=True) + if serializer.is_valid(): + serializer.save(status='REREVIEW') + return Response({"message": "Budget updated and status changed to 'Dean Review'."}, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class RejectBudgetAPIView(APIView): def put(self, request): @@ -1537,21 +1555,23 @@ def get(self, request): timeframe = request.GET.get('timeframe', '').lower() now = timezone.now() if timeframe == 'weekly': - time_threshold = now - timedelta(weeks=1) + time_threshold = (now - timedelta(weeks=1)) elif timeframe == 'monthly': time_threshold = now - timedelta(days=30) elif timeframe == '6 months': time_threshold = now - timedelta(days=182) # Approximation for half a year else: time_threshold = None - print(time_threshold) + print(time_threshold,now) # Fetch all unique clubs clubs = Event_info.objects.values_list('club', flat=True).distinct() has_events = False + print(clubs) for club in clubs: club_events = EventInput.objects.filter(event__club=club) if time_threshold: club_events = club_events.filter(event__end_date__range=(time_threshold, now)) + print(club_events) if club_events.exists(): has_events = True break @@ -1792,4 +1812,17 @@ def get(self, request, report_id): return FileResponse(event_report.report_pdf.open('rb'), content_type='application/pdf') except EventReport.DoesNotExist: - return Response({"error": "Event report not found"}, status=status.HTTP_404_NOT_FOUND) \ No newline at end of file + return Response({"error": "Event report not found"}, status=status.HTTP_404_NOT_FOUND) + +class UpdateBudgetAPIView(APIView): + def put(self, request): + budget_id = request.data.get('id') + budget = get_object_or_404(Budget, id=budget_id) + if budget.status != 'COORDINATOR': + return Response({"error": "Budget is not under Coordinator."}, status=status.HTTP_400_BAD_REQUEST) + budget.status = 'FIC' + serializer = BudgetSerializer(budget, data=request.data, partial=True) + if serializer.is_valid(): + serializer.save(status=budget.status) + return Response({"message": "Budget updated and status changed"}, status=status.HTTP_200_OK) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file diff --git a/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py b/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py new file mode 100644 index 000000000..0acad6f1b --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py @@ -0,0 +1,48 @@ +# Generated by Django 3.1.5 on 2025-03-23 17:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0010_eventreport'), + ] + + operations = [ + migrations.RenameField( + model_name='budget', + old_name='budget_amt', + new_name='budget_requested', + ), + migrations.AddField( + model_name='budget', + name='budget_allocated', + field=models.IntegerField(default=0, null=True), + ), + migrations.AddField( + model_name='budget', + name='budget_comment', + field=models.CharField(max_length=2000, null=True), + ), + migrations.AlterField( + model_name='budget', + name='status', + field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review'), ('REREVIEW', 'ReReview')], default='COORDINATOR', max_length=50), + ), + migrations.AlterField( + model_name='event_info', + name='status', + field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review'), ('REREVIEW', 'ReReview')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='event_info', + name='venue', + field=models.CharField(choices=[('CR101', 'CR101'), ('CR102', 'CR102'), ('CR103', 'CR103'), ('CR104', 'CR104'), ('CR107', 'CR107'), ('CR108', 'CR108'), ('CR109', 'CR109'), ('CR201', 'CR201'), ('CR202', 'CR202'), ('CR208', 'CR208'), ('L101', 'L101'), ('L102', 'L102'), ('L103', 'L103'), ('L104', 'L104'), ('L105', 'L105'), ('L106', 'L106'), ('L107', 'L107'), ('L108', 'L108'), ('L201', 'L201'), ('L202', 'L202'), ('L206', 'L206'), ('L207', 'L207'), ('Football Ground', 'Football Ground'), ('Cricket Ground', 'Cricket Ground'), ('Basketball Ground', 'Basketball Ground'), ('Volleyball Ground', 'Volleyball Ground'), ('Tennis Court', 'Tennis Court'), ('Athletics Ground', 'Athletics Ground'), ('Badminton Court', 'Badminton Court'), ('Table Tennis Court', 'Table Tennis Court'), ('Chess Room', 'Chess Room'), ('Carrom Room', 'Carrom Room'), ('Gym', 'Gym'), ('CC First Floor', 'CC First Floor'), ('CC Second Floor', 'CC Second Floor'), ('CC Third Floor', 'CC Third Floor'), ('OAT', 'OAT')], max_length=50), + ), + migrations.AlterField( + model_name='session_info', + name='venue', + field=models.CharField(choices=[('CR101', 'CR101'), ('CR102', 'CR102'), ('CR103', 'CR103'), ('CR104', 'CR104'), ('CR107', 'CR107'), ('CR108', 'CR108'), ('CR109', 'CR109'), ('CR201', 'CR201'), ('CR202', 'CR202'), ('CR208', 'CR208'), ('L101', 'L101'), ('L102', 'L102'), ('L103', 'L103'), ('L104', 'L104'), ('L105', 'L105'), ('L106', 'L106'), ('L107', 'L107'), ('L108', 'L108'), ('L201', 'L201'), ('L202', 'L202'), ('L206', 'L206'), ('L207', 'L207'), ('Football Ground', 'Football Ground'), ('Cricket Ground', 'Cricket Ground'), ('Basketball Ground', 'Basketball Ground'), ('Volleyball Ground', 'Volleyball Ground'), ('Tennis Court', 'Tennis Court'), ('Athletics Ground', 'Athletics Ground'), ('Badminton Court', 'Badminton Court'), ('Table Tennis Court', 'Table Tennis Court'), ('Chess Room', 'Chess Room'), ('Carrom Room', 'Carrom Room'), ('Gym', 'Gym'), ('CC First Floor', 'CC First Floor'), ('CC Second Floor', 'CC Second Floor'), ('CC Third Floor', 'CC Third Floor'), ('OAT', 'OAT')], max_length=50), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index 06c77c1a3..d33450eaf 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -34,24 +34,48 @@ class Constants: ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), - ('DEAN', 'Dean Review') + ('DEAN', 'Dean Review'), + ('REREVIEW', 'ReReview'), ) fest = (("Abhikalpan", "Abhikalpan"), ("Gusto", "Gusto"), ("Tarang", "Tarang")) venue = ( - ( - "Classroom", - ( - ("CR101", "CR101"), - ("CR102", "CR102"), - ), - ), - ( - "Lecturehall", - ( - ("L101", "L101"), - ("L102", "L102"), - ), - ), + ("CR101", "CR101"), + ("CR102", "CR102"), + ("CR103", "CR103"), + ("CR104", "CR104"), + ("CR107", "CR107"), + ("CR108", "CR108"), + ("CR109", "CR109"), + ("CR201", "CR201"), + ("CR202", "CR202"), + ("CR208", "CR208"), + ("L101", "L101"), + ("L102", "L102"), + ("L103", "L103"), + ("L104", "L104"), + ("L105", "L105"), + ("L106", "L106"), + ("L107", "L107"), + ("L108", "L108"), + ("L201", "L201"), + ("L202", "L202"), + ("L206", "L206"), + ("L207", "L207"), + ("Football Ground", "Football Ground"), + ("Cricket Ground", "Cricket Ground"), + ("Basketball Ground", "Basketball Ground"), + ("Volleyball Ground", "Volleyball Ground"), + ("Tennis Court", "Tennis Court"), + ("Athletics Ground", "Athletics Ground"), + ("Badminton Court", "Badminton Court"), + ("Table Tennis Court", "Table Tennis Court"), + ("Chess Room", "Chess Room"), + ("Carrom Room", "Carrom Room"), + ("Gym", "Gym"), + ("CC First Floor", "CC First Floor"), + ("CC Second Floor", "CC Second Floor"), + ("CC Third Floor", "CC Third Floor"), + ("OAT", "OAT"), ) @@ -556,11 +580,13 @@ class Budget(models.Model): Club_info, on_delete=models.CASCADE, max_length=50, null=False ) budget_for = models.CharField(max_length=256, null=False) - budget_amt = models.IntegerField(default=0, null=False) + budget_requested = models.IntegerField(default=0, null=False) + budget_allocated = models.IntegerField(default=0, null=True) budget_file = models.FileField(upload_to="uploads/", null=True) description = models.TextField(max_length=256, null=False) status = models.CharField(max_length=50, choices=Constants.STATUS_CHOICES, default="COORDINATOR") remarks = models.CharField(max_length=256, null=True) + budget_comment = models.CharField(max_length=2000, null=True) def __str__(self): return str(self.id) diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 013d3490d..08be988c8 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -10,6 +10,7 @@ ClubMemberApproveView, ClubMemberDeleteAPIView, CreateClubAPIView, + DeanReviewBudgetAPIView, DeleteClubAPIView, DeleteClubBudgetAPIView, EventDeleteAPIView, @@ -229,6 +230,7 @@ DeanApproveBudgetAPIView.as_view(), name="dean approve budget", ), + url(r'^api/dean_review_budget/$', DeanReviewBudgetAPIView.as_view(), name = 'review budget'), # new event api url(r"^api/new_events/$", NewEventAPIView.as_view(), name="new events"), # fic approve event api @@ -289,7 +291,7 @@ ListClubPositionAPIView.as_view(), name="list club position", ), - url(r"^/api/new_event/$", UpdateEventAPIView.as_view(), name="update event"), + url(r"^api/new_event/$", UpdateEventAPIView.as_view(), name="update event"), url(r"^api/update_event/$", UpdateEventAPIView.as_view(), name="update event"), url(r"^api/update_budget/$", UpdateBudgetAPIView.as_view(), name="update budget"), url(r"^fest/$" , FestListView.as_view(), name="fest"), @@ -300,5 +302,6 @@ url(r'^api/newsletter_pdf/$', NewsletterPDFAPIView.as_view(), name='newsletter_pdf'), url(r'^api/event_report_list/$', EventReportListAPIView.as_view(), name='event_report_list'), url(r'^api/add_event_report/$', EventReportAPIView.as_view(), name='add_event_report'), - url(r'^api/event_report_pdf/(?P\d+)/$', EventReportPDFView.as_view(), name='event_report_pdf') + url(r'^api/event_report_pdf/(?P\d+)/$', EventReportPDFView.as_view(), name='event_report_pdf'), + url(r'^api/update_budget/$', UpdateBudgetAPIView.as_view(), name='update event'), ] From 0bd8a87d906816518a804380109952815792fc1a Mon Sep 17 00:00:00 2001 From: RISHIKESHk07 Date: Sun, 23 Mar 2025 21:56:42 +0530 Subject: [PATCH 11/11] feat(fix : removed Migration file changes) --- .../migrations/0002_auto_20250210_1657.py | 38 ------- .../eis/migrations/0002_auto_20250210_1657.py | 53 ---------- .../migrations/0002_auto_20241013_2251.py | 98 ------------------- .../migrations/0003_auto_20241016_0911.py | 48 --------- .../gymkhana/migrations/0004_achievements.py | 25 ----- .../migrations/0005_auto_20241017_2131.py | 18 ---- .../gymkhana/migrations/0006_clubposition.py | 26 ----- .../gymkhana/migrations/0007_fest.py | 27 ----- .../migrations/0008_auto_20250217_1709.py | 18 ---- .../gymkhana/migrations/0009_eventinput.py | 23 ----- .../gymkhana/migrations/0010_eventreport.py | 34 ------- .../migrations/0011_auto_20250323_1711.py | 48 --------- .../migrations/0002_auto_20250210_1657.py | 23 ----- .../migrations/0002_auto_20250210_1657.py | 18 ---- 14 files changed, 497 deletions(-) delete mode 100644 FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py delete mode 100644 FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0004_achievements.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0007_fest.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py delete mode 100644 FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py delete mode 100644 FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py delete mode 100644 FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py diff --git a/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py deleted file mode 100644 index 222f0ac60..000000000 --- a/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20250210_1657.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-10 16:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('academic_procedures', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='assistantshipclaim', - name='year', - field=models.IntegerField(choices=[(2025, 2025), (2024, 2024)]), - ), - migrations.AlterField( - model_name='course_registration', - name='working_year', - field=models.IntegerField(blank=True, choices=[(2025, 2025), (2024, 2024)], null=True), - ), - migrations.AlterField( - model_name='finalregistrations', - name='batch', - field=models.IntegerField(default=2025), - ), - migrations.AlterField( - model_name='messdue', - name='year', - field=models.IntegerField(choices=[(2025, 2025), (2024, 2024)]), - ), - migrations.AlterField( - model_name='register', - name='year', - field=models.IntegerField(default=2025), - ), - ] diff --git a/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py deleted file mode 100644 index e36e751be..000000000 --- a/FusionIIIT/applications/eis/migrations/0002_auto_20250210_1657.py +++ /dev/null @@ -1,53 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-10 16:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('eis', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='emp_achievement', - name='a_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_confrence_organised', - name='k_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_expert_lectures', - name='l_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_keynote_address', - name='k_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_mtechphd_thesis', - name='s_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_patents', - name='p_year', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_published_books', - name='pyear', - field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], null=True, verbose_name='year'), - ), - migrations.AlterField( - model_name='emp_research_papers', - name='year', - field=models.CharField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025)], max_length=10, null=True), - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py deleted file mode 100644 index 67cd41461..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0002_auto_20241013_2251.py +++ /dev/null @@ -1,98 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-13 22:51 - -from django.db import migrations, models -import django.db.models.deletion -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Budget', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('budget_for', models.CharField(max_length=256)), - ('budget_amt', models.IntegerField(default=0)), - ('budget_file', models.FileField(upload_to='uploads/')), - ('description', models.TextField(max_length=256)), - ('status', models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review')], default='COORDINATOR', max_length=50)), - ('remarks', models.CharField(max_length=256, null=True)), - ('club', models.ForeignKey(max_length=50, on_delete=django.db.models.deletion.CASCADE, to='gymkhana.club_info')), - ], - options={ - 'db_table': 'Budget', - }, - ), - migrations.CreateModel( - name='Budget_Comments', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('commentator_designation', models.CharField(max_length=100)), - ('comment', models.TextField()), - ('comment_date', models.DateField(default=django.utils.timezone.now)), - ('comment_time', models.TimeField(default=django.utils.timezone.now)), - ('budget_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='gymkhana.budget')), - ], - options={ - 'db_table': 'Budget_Comments', - }, - ), - migrations.CreateModel( - name='Event_Comments', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('commentator_designation', models.CharField(max_length=100)), - ('comment', models.TextField()), - ('comment_date', models.DateField(default=django.utils.timezone.now)), - ('comment_time', models.TimeField(default=django.utils.timezone.now)), - ], - options={ - 'db_table': 'Event_Comments', - }, - ), - migrations.RemoveField( - model_name='voting_choices', - name='poll_event', - ), - migrations.RemoveField( - model_name='voting_voters', - name='poll_event', - ), - migrations.RenameField( - model_name='event_info', - old_name='date', - new_name='end_date', - ), - migrations.AddField( - model_name='event_info', - name='start_date', - field=models.DateField(default=None), - ), - migrations.AlterField( - model_name='event_info', - name='status', - field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review')], default='open', max_length=50), - ), - migrations.DeleteModel( - name='Core_team', - ), - migrations.DeleteModel( - name='Voting_choices', - ), - migrations.DeleteModel( - name='Voting_polls', - ), - migrations.DeleteModel( - name='Voting_voters', - ), - migrations.AddField( - model_name='event_comments', - name='Event_id', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='gymkhana.event_info'), - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py b/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py deleted file mode 100644 index 7d53d8e10..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0003_auto_20241016_0911.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-16 09:11 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0002_auto_20241013_2251'), - ] - - operations = [ - migrations.AlterField( - model_name='budget', - name='budget_file', - field=models.FileField(null=True, upload_to='uploads/'), - ), - migrations.AlterField( - model_name='change_office', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='club_budget', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='club_info', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='club_member', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='fest_budget', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='session_info', - name='status', - field=models.CharField(choices=[('open', 'Open'), ('confirmed', 'Confirmed'), ('rejected', 'Rejected'), ('member', 'Member'), ('co-ordinator', 'Co-ordinator'), ('Co-cordinator', 'Co-cordinator')], default='open', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py b/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py deleted file mode 100644 index 1b5768796..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0004_achievements.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-16 21:30 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0003_auto_20241016_0911'), - ] - - operations = [ - migrations.CreateModel( - name='Achievements', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('club_name', models.CharField(max_length=100)), - ('title', models.CharField(max_length=100)), - ('achievement', models.TextField()), - ], - options={ - 'db_table': 'Achievements', - }, - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py b/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py deleted file mode 100644 index 5c6910f57..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0005_auto_20241017_2131.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-17 21:31 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0004_achievements'), - ] - - operations = [ - migrations.RenameField( - model_name='event_comments', - old_name='Event_id', - new_name='event_id', - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py b/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py deleted file mode 100644 index b5036189f..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0006_clubposition.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-22 21:31 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0005_auto_20241017_2131'), - ] - - operations = [ - migrations.CreateModel( - name='ClubPosition', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('position', models.CharField(choices=[('FIC', 'FIC'), ('COORDINATOR', 'Coordinator'), ('TECHNICAL_COUNSELLOR', 'Technical counsellor'), ('SPORTS_COUNSELLOR', 'Sports counsellor'), ('CULTURAL_COUNSELLOR', 'Cultural counsellor')], max_length=50)), - ('club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.club_info')), - ], - options={ - 'db_table': 'ClubPosition', - }, - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0007_fest.py b/FusionIIIT/applications/gymkhana/migrations/0007_fest.py deleted file mode 100644 index b43454cfd..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0007_fest.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-10 16:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0006_clubposition'), - ] - - operations = [ - migrations.CreateModel( - name='Fest', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('name', models.CharField(max_length=50)), - ('category', models.CharField(max_length=50)), - ('description', models.TextField(max_length=256, null=True)), - ('date', models.DateField(default=None)), - ('link', models.CharField(max_length=256, null=True)), - ], - options={ - 'db_table': 'fest', - }, - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py b/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py deleted file mode 100644 index dc06e5c21..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0008_auto_20250217_1709.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-17 17:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0007_fest'), - ] - - operations = [ - migrations.AlterField( - model_name='fest', - name='category', - field=models.CharField(choices=[('Technical', 'Technical'), ('Sports', 'Sports'), ('Cultural', 'Cultural')], max_length=50), - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py b/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py deleted file mode 100644 index 30655a21b..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0009_eventinput.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.1.5 on 2025-03-22 17:17 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0008_auto_20250217_1709'), - ] - - operations = [ - migrations.CreateModel( - name='EventInput', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('description', models.TextField(max_length=500)), - ('images', models.ImageField(null=True, upload_to='gymkhana/event_images')), - ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.event_info')), - ], - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py b/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py deleted file mode 100644 index 14cfa47a6..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0010_eventreport.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 3.1.5 on 2025-03-22 23:28 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0009_eventinput'), - ] - - operations = [ - migrations.CreateModel( - name='EventReport', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('description', models.TextField(blank=True, null=True)), - ('venue', models.CharField(max_length=100)), - ('incharge', models.CharField(max_length=50)), - ('start_date', models.DateField()), - ('end_date', models.DateField()), - ('start_time', models.TimeField()), - ('end_time', models.TimeField()), - ('event_budget', models.DecimalField(decimal_places=2, max_digits=10)), - ('special_announcement', models.TextField(blank=True, null=True)), - ('report_pdf', models.FileField(blank=True, null=True, upload_to='event_reports/')), - ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gymkhana.event_info')), - ], - options={ - 'db_table': 'EventReport', - }, - ), - ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py b/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py deleted file mode 100644 index 0acad6f1b..000000000 --- a/FusionIIIT/applications/gymkhana/migrations/0011_auto_20250323_1711.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 3.1.5 on 2025-03-23 17:11 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('gymkhana', '0010_eventreport'), - ] - - operations = [ - migrations.RenameField( - model_name='budget', - old_name='budget_amt', - new_name='budget_requested', - ), - migrations.AddField( - model_name='budget', - name='budget_allocated', - field=models.IntegerField(default=0, null=True), - ), - migrations.AddField( - model_name='budget', - name='budget_comment', - field=models.CharField(max_length=2000, null=True), - ), - migrations.AlterField( - model_name='budget', - name='status', - field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review'), ('REREVIEW', 'ReReview')], default='COORDINATOR', max_length=50), - ), - migrations.AlterField( - model_name='event_info', - name='status', - field=models.CharField(choices=[('ACCEPT', 'Accepted'), ('REJECT', 'Rejected'), ('COORDINATOR', 'Coordinator Review'), ('FIC', 'FIC Review'), ('COUNSELLOR', 'Counsellor Review'), ('DEAN', 'Dean Review'), ('REREVIEW', 'ReReview')], default='open', max_length=50), - ), - migrations.AlterField( - model_name='event_info', - name='venue', - field=models.CharField(choices=[('CR101', 'CR101'), ('CR102', 'CR102'), ('CR103', 'CR103'), ('CR104', 'CR104'), ('CR107', 'CR107'), ('CR108', 'CR108'), ('CR109', 'CR109'), ('CR201', 'CR201'), ('CR202', 'CR202'), ('CR208', 'CR208'), ('L101', 'L101'), ('L102', 'L102'), ('L103', 'L103'), ('L104', 'L104'), ('L105', 'L105'), ('L106', 'L106'), ('L107', 'L107'), ('L108', 'L108'), ('L201', 'L201'), ('L202', 'L202'), ('L206', 'L206'), ('L207', 'L207'), ('Football Ground', 'Football Ground'), ('Cricket Ground', 'Cricket Ground'), ('Basketball Ground', 'Basketball Ground'), ('Volleyball Ground', 'Volleyball Ground'), ('Tennis Court', 'Tennis Court'), ('Athletics Ground', 'Athletics Ground'), ('Badminton Court', 'Badminton Court'), ('Table Tennis Court', 'Table Tennis Court'), ('Chess Room', 'Chess Room'), ('Carrom Room', 'Carrom Room'), ('Gym', 'Gym'), ('CC First Floor', 'CC First Floor'), ('CC Second Floor', 'CC Second Floor'), ('CC Third Floor', 'CC Third Floor'), ('OAT', 'OAT')], max_length=50), - ), - migrations.AlterField( - model_name='session_info', - name='venue', - field=models.CharField(choices=[('CR101', 'CR101'), ('CR102', 'CR102'), ('CR103', 'CR103'), ('CR104', 'CR104'), ('CR107', 'CR107'), ('CR108', 'CR108'), ('CR109', 'CR109'), ('CR201', 'CR201'), ('CR202', 'CR202'), ('CR208', 'CR208'), ('L101', 'L101'), ('L102', 'L102'), ('L103', 'L103'), ('L104', 'L104'), ('L105', 'L105'), ('L106', 'L106'), ('L107', 'L107'), ('L108', 'L108'), ('L201', 'L201'), ('L202', 'L202'), ('L206', 'L206'), ('L207', 'L207'), ('Football Ground', 'Football Ground'), ('Cricket Ground', 'Cricket Ground'), ('Basketball Ground', 'Basketball Ground'), ('Volleyball Ground', 'Volleyball Ground'), ('Tennis Court', 'Tennis Court'), ('Athletics Ground', 'Athletics Ground'), ('Badminton Court', 'Badminton Court'), ('Table Tennis Court', 'Table Tennis Court'), ('Chess Room', 'Chess Room'), ('Carrom Room', 'Carrom Room'), ('Gym', 'Gym'), ('CC First Floor', 'CC First Floor'), ('CC Second Floor', 'CC Second Floor'), ('CC Third Floor', 'CC Third Floor'), ('OAT', 'OAT')], max_length=50), - ), - ] diff --git a/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py deleted file mode 100644 index 41904d1a8..000000000 --- a/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20250210_1657.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-10 16:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('programme_curriculum', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='batch', - name='year', - field=models.PositiveIntegerField(default=2025), - ), - migrations.AlterField( - model_name='programme', - name='programme_begin_year', - field=models.PositiveIntegerField(default=2025), - ), - ] diff --git a/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py b/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py deleted file mode 100644 index 97a1141f4..000000000 --- a/FusionIIIT/applications/scholarships/migrations/0002_auto_20250210_1657.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2025-02-10 16:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('scholarships', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='previous_winner', - name='year', - field=models.IntegerField(default=2025), - ), - ]