From c29fdb7abcb5351b6212a5eddb58b19f313f5dfa Mon Sep 17 00:00:00 2001 From: "Puliuvarthi.Mahesh" <134507390+MaheshPulivarthi18@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:01:02 +0530 Subject: [PATCH 01/27] feat: new use case implementation and fixes in existing APIs --- FusionIIIT/Fusion/settings/development.py | 39 ++- .../migrations/0002_auto_20240115_1651.py | 38 +++ .../eis/migrations/0002_auto_20240115_1651.py | 53 ++++ .../migrations/0002_auto_20240115_1651.py | 18 ++ .../migrations/0003_auto_20240210_1752.py | 18 ++ .../migrations/0004_auto_20240212_1537.py | 18 ++ .../migrations/0005_auto_20240212_2152.py | 18 ++ .../migrations/0006_auto_20240212_2215.py | 18 ++ .../migrations/0007_auto_20240213_0036.py | 18 ++ .../migrations/0008_auto_20240213_1739.py | 18 ++ .../migrations/0009_auto_20240214_1648.py | 18 ++ .../migrations/0010_auto_20240214_1808.py | 19 ++ FusionIIIT/applications/globals/models.py | 2 +- .../migrations/0002_auto_20240214_1808.py | 33 +++ FusionIIIT/applications/gymkhana/models.py | 265 +++++++++--------- FusionIIIT/applications/gymkhana/views.py | 93 +++--- FusionIIIT/applications/iwdModuleV2/urls.py | 2 - .../migrations/0002_auto_20240115_1651.py | 23 ++ .../migrations/0002_auto_20240115_1651.py | 18 ++ .../templates/gymkhanaModule/active_poll.html | 36 +-- .../templates/gymkhanaModule/create_poll.html | 38 +-- requirements.txt => requirements1.txt | 18 +- 22 files changed, 575 insertions(+), 246 deletions(-) create mode 100644 FusionIIIT/applications/academic_procedures/migrations/0002_auto_20240115_1651.py create mode 100644 FusionIIIT/applications/eis/migrations/0002_auto_20240115_1651.py create mode 100644 FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py create mode 100644 FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py create mode 100644 FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py create mode 100644 FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py create mode 100644 FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py create mode 100644 FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py create mode 100644 FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py create mode 100644 FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py create mode 100644 FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0002_auto_20240214_1808.py create mode 100644 FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20240115_1651.py create mode 100644 FusionIIIT/applications/scholarships/migrations/0002_auto_20240115_1651.py rename requirements.txt => requirements1.txt (88%) diff --git a/FusionIIIT/Fusion/settings/development.py b/FusionIIIT/Fusion/settings/development.py index 6acc214c1..3c5a1323d 100644 --- a/FusionIIIT/Fusion/settings/development.py +++ b/FusionIIIT/Fusion/settings/development.py @@ -2,45 +2,40 @@ DEBUG = True -SECRET_KEY = '=&w9due426k@l^ju1=s1)fj1rnpf0ok8xvjwx+62_nc-f12-8(' +SECRET_KEY = "=&w9due426k@l^ju1=s1)fj1rnpf0ok8xvjwx+62_nc-f12-8(" -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ["*"] DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'fusionlab', - 'HOST': os.environ.get("DB_HOST", default='localhost'), - 'USER': 'fusion_admin', - 'PASSWORD': 'hello123', + "default": { + "ENGINE": "django.db.backends.postgresql_psycopg2", + "NAME": "fusionlab", + "HOST": os.environ.get("DB_HOST", default="localhost"), + "USER": "fusion_admin", + "PASSWORD": "hello123", } } REST_FRAMEWORK = { - 'DEFAULT_AUTHENTICATION_CLASSES': ( - 'rest_framework.authentication.TokenAuthentication', + "DEFAULT_AUTHENTICATION_CLASSES": ( + "rest_framework.authentication.TokenAuthentication", ), - 'DEFAULT_PERMISSION_CLASSES': ( - 'rest_framework.permissions.IsAuthenticated', - ) + "DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",), } if DEBUG: - MIDDLEWARE += ( - 'debug_toolbar.middleware.DebugToolbarMiddleware', - ) + MIDDLEWARE += ("debug_toolbar.middleware.DebugToolbarMiddleware",) INSTALLED_APPS += ( - 'debug_toolbar', - 'django_extensions', - ) - + "debug_toolbar", + "django_extensions", + ) ############################### # DJANGO_EXTENSIONS SETTINGS: # ############################### INTERNAL_IPS = [ - '127.0.0.1', + "127.0.0.1", ] ############################### @@ -51,5 +46,5 @@ SHELL_PLUS_PRINT_SQL = True DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False, + "INTERCEPT_REDIRECTS": False, } diff --git a/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20240115_1651.py new file mode 100644 index 000000000..4468e53b3 --- /dev/null +++ b/FusionIIIT/applications/academic_procedures/migrations/0002_auto_20240115_1651.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.5 on 2024-01-15 16:51 + +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=[(2024, 2024), (2023, 2023)]), + ), + migrations.AlterField( + model_name='course_registration', + name='working_year', + field=models.IntegerField(blank=True, choices=[(2024, 2024), (2023, 2023)], null=True), + ), + migrations.AlterField( + model_name='finalregistrations', + name='batch', + field=models.IntegerField(default=2024), + ), + migrations.AlterField( + model_name='messdue', + name='year', + field=models.IntegerField(choices=[(2024, 2024), (2023, 2023)]), + ), + migrations.AlterField( + model_name='register', + name='year', + field=models.IntegerField(default=2024), + ), + ] diff --git a/FusionIIIT/applications/eis/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/eis/migrations/0002_auto_20240115_1651.py new file mode 100644 index 000000000..12cc5028f --- /dev/null +++ b/FusionIIIT/applications/eis/migrations/0002_auto_20240115_1651.py @@ -0,0 +1,53 @@ +# Generated by Django 3.1.5 on 2024-01-15 16:51 + +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)], 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)], 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)], 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)], 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)], 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)], 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)], 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)], max_length=10, null=True), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py new file mode 100644 index 000000000..e7c68233d --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-01-15 16:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py b/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py new file mode 100644 index 000000000..50441b81b --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-10 17:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0002_auto_20240115_1651'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py b/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py new file mode 100644 index 000000000..0e5541cb3 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-12 15:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0003_auto_20240210_1752'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py b/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py new file mode 100644 index 000000000..e5cb98c49 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-12 21:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0004_auto_20240212_1537'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py b/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py new file mode 100644 index 000000000..ab252a31d --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-12 22:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0005_auto_20240212_2152'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py b/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py new file mode 100644 index 000000000..f5984571a --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-13 00:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0006_auto_20240212_2215'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py b/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py new file mode 100644 index 000000000..e710bc7c6 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-13 17:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0007_auto_20240213_0036'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py b/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py new file mode 100644 index 000000000..f935078e8 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-14 16:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0008_auto_20240213_1739'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py b/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py new file mode 100644 index 000000000..00b23336e --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.5 on 2024-02-14 18:08 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0009_auto_20240214_1648'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='department', + field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='globals.departmentinfo'), + ), + ] diff --git a/FusionIIIT/applications/globals/models.py b/FusionIIIT/applications/globals/models.py index 31eedcfb4..ba982a0e1 100644 --- a/FusionIIIT/applications/globals/models.py +++ b/FusionIIIT/applications/globals/models.py @@ -149,7 +149,7 @@ class ExtraInfo(models.Model): phone_no = models.BigIntegerField(null=True, default=9999999999) user_type = models.CharField(max_length=20, choices=Constants.USER_CHOICES) department = models.ForeignKey( - DepartmentInfo, on_delete=models.CASCADE, null=True, blank=True) + DepartmentInfo, on_delete=models.CASCADE, null=False, blank=True) profile_picture = models.ImageField( null=True, blank=True, upload_to='globals/profile_pictures') about_me = models.TextField(default='NA', max_length=1000, blank=True) diff --git a/FusionIIIT/applications/gymkhana/migrations/0002_auto_20240214_1808.py b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20240214_1808.py new file mode 100644 index 000000000..5089e68d9 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20240214_1808.py @@ -0,0 +1,33 @@ +# Generated by Django 3.1.5 on 2024-02-14 18:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='club_info', + name='created_on', + field=models.DateField(default=None), + ), + migrations.AddField( + model_name='club_info', + name='head_changed_on', + field=models.DateField(default=None), + ), + migrations.AlterField( + model_name='registration_form', + name='roll', + field=models.CharField(default='20160017', max_length=8, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='session_info', + name='end_time', + field=models.TimeField(default=None), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index c4513b236..caaf126bb 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -19,34 +19,31 @@ # # Class for various choices on the enumerations class Constants: available = ( - ('On', 'On'), - ('Off', 'Off'), + ("On", "On"), + ("Off", "Off"), ) categoryCh = ( - ('Technical', 'Technical'), - ('Sports', 'Sports'), - ('Cultural', 'Cultural') - ) - status = ( - ('open', 'Open'), - ('confirmed', 'Confirmed'), - ('rejected', 'Rejected') - ) - fest = ( - ('Abhikalpan', 'Abhikalpan'), - ('Gusto', 'Gusto'), - ('Tarang', 'Tarang') + ("Technical", "Technical"), + ("Sports", "Sports"), + ("Cultural", "Cultural"), ) + status = (("open", "Open"), ("confirmed", "Confirmed"), ("rejected", "Rejected")) + fest = (("Abhikalpan", "Abhikalpan"), ("Gusto", "Gusto"), ("Tarang", "Tarang")) venue = ( - ('Classroom', ( - ('CR101', 'CR101'), - ('CR102', 'CR102'), - )), - ('Lecturehall', ( - ('L101', 'L101'), - ('L102', 'L102'), - )), - + ( + "Classroom", + ( + ("CR101", "CR101"), + ("CR102", "CR102"), + ), + ), + ( + "Lecturehall", + ( + ("L101", "L101"), + ("L102", "L102"), + ), + ), ) @@ -58,7 +55,7 @@ class Club_info(models.Model): club_name - name of the club club_website - url of the club website - category - to which category it belongs to + category - to which category it belongs to co_ordinator - refers to the id of co_ordinator of the club co_coordinator - refers to the id of co_coordinator of the club faculty_incharge - the lecturer/proffesor who is incharge of this club. @@ -66,41 +63,50 @@ class Club_info(models.Model): activity_calender - it is the url of club logo description - refers to brief explanation about the club alloted_budget - the amount alloted to the club - spent_budget - the amount spent by the club + spent_budget - the amount spent by the club avail_budget - the amount available at the club status - status of club wheather it is confirmed or not - + """ + club_name = models.CharField(max_length=50, null=False, primary_key=True) club_website = models.CharField(max_length=150, null=True, default="hello") - category = models.CharField( - max_length=50, null=False, choices=Constants.categoryCh) - co_ordinator = models.ForeignKey(Student, on_delete=models.CASCADE, null=False, related_name='co_of') + category = models.CharField(max_length=50, null=False, choices=Constants.categoryCh) + co_ordinator = models.ForeignKey( + Student, on_delete=models.CASCADE, null=False, related_name="co_of" + ) co_coordinator = models.ForeignKey( - Student, on_delete=models.CASCADE, null=False, related_name='coco_of') + Student, on_delete=models.CASCADE, null=False, related_name="coco_of" + ) faculty_incharge = models.ForeignKey( - Faculty, on_delete=models.CASCADE, null=False, related_name='faculty_incharge_of') - club_file = models.FileField(upload_to='gymkhana/club_poster', null=True) + Faculty, + on_delete=models.CASCADE, + null=False, + related_name="faculty_incharge_of", + ) + club_file = models.FileField(upload_to="gymkhana/club_poster", null=True) activity_calender = models.FileField( - upload_to='gymkhana/activity_calender', null=True, default=" ") + upload_to="gymkhana/activity_calender", null=True, default=" " + ) description = models.TextField(max_length=256, null=True) alloted_budget = models.IntegerField(null=True, default=0) spent_budget = models.IntegerField(null=True, default=0) avail_budget = models.IntegerField(null=True, default=0) - status = models.CharField( - max_length=50, choices=Constants.status, default='open') + status = models.CharField(max_length=50, choices=Constants.status, default="open") + head_changed_on = models.DateField(default=None, auto_now=False, null=False) + created_on = models.DateField(default=None, auto_now=False, null=False) def __str__(self): return str(self.club_name) class Meta: - db_table = 'Club_info' + db_table = "Club_info" class Form_available(models.Model): """ It stores registered form name , roll number and status. - + roll - roll number of the student status - it is a boolean value wheather the form is available or not form_name - name of the form @@ -109,13 +115,14 @@ class Form_available(models.Model): roll = models.CharField(default=2016001, max_length=7, primary_key=True) status = models.BooleanField(default=True, max_length=5) - form_name = models.CharField(default='senate_registration', max_length=30) + form_name = models.CharField(default="senate_registration", max_length=30) def __str__(self): return str(self.roll) class Meta: - db_table = 'Form_available' + db_table = "Form_available" + class Registration_form(models.Model): """ @@ -129,17 +136,17 @@ class Registration_form(models.Model): """ - roll = models.CharField(max_length=7, default="2016001", primary_key=True) + roll = models.CharField(max_length=8, default="20160017", primary_key=True) user_name = models.CharField(max_length=40, default="Student") - branch = models.CharField(max_length=20, default='open') + branch = models.CharField(max_length=20, default="open") cpi = models.FloatField(max_length=3, default=6.0) - programme = models.CharField(max_length=20, default='B.tech') + programme = models.CharField(max_length=20, default="B.tech") def __str__(self): return str(self.roll) class Meta: - db_table = 'Registration_form' + db_table = "Registration_form" class Club_member(models.Model): @@ -154,22 +161,23 @@ class Club_member(models.Model): remarks - remarks of the student by the club if any. """ + id = models.AutoField(primary_key=True) member = models.ForeignKey( - Student, on_delete=models.CASCADE, related_name='member_of') - club = models.ForeignKey(Club_info, on_delete=models.CASCADE, related_name='this_club', null=False) + Student, on_delete=models.CASCADE, related_name="member_of" + ) + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, related_name="this_club", null=False + ) description = 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, default="open") remarks = models.CharField(max_length=256, null=True) def __str__(self): return str(self.member.id) class Meta: - db_table = 'Club_member' - - + db_table = "Club_member" class Core_team(models.Model): @@ -186,13 +194,14 @@ class Core_team(models.Model): 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') + 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) + 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) @@ -200,38 +209,35 @@ def __str__(self): return str(self.student_id) class Meta: - db_table = 'Core_team' + db_table = "Core_team" class Club_budget(models.Model): - """ Records the budget details of the clubs. - id - serial number club - name of the club budget_for - the purpose of the budget,like for equipment or for event etc.., budget_amt - the amount required for the club budget_file - it is file which contains complete details regarding the amount they want to spend descrion - description about the budget if any - """ - id = models.AutoField(primary_key=True) - club = models.ForeignKey(Club_info,on_delete=models.CASCADE, max_length=50, null=False) + 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=False) + budget_file = models.FileField(upload_to="uploads/", null=False) description = models.TextField(max_length=256, null=False) - status = models.CharField( - max_length=50, choices=Constants.status, default='open') + status = models.CharField(max_length=50, choices=Constants.status, default="open") remarks = models.CharField(max_length=256, null=True) def __str__(self): return str(self.id) class Meta: - db_table = 'Club_budget' + db_table = "Club_budget" class Session_info(models.Model): @@ -241,31 +247,31 @@ class Session_info(models.Model): id - serial number club - name of the club venue - the place at which they conducting the session - date - date of the session + date - date of the session start_time - the time at which session starts end_time - the time at which session ends session_poster - the logo/poster for the session(image) details - for which purpose they are taking the session status - wheather it is approved/rejected. - """ id = models.AutoField(primary_key=True) - club = models.ForeignKey(Club_info, on_delete=models.CASCADE,max_length=50, null=True) - venue = models.CharField(max_length=50, null=False, - choices=Constants.venue) + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, max_length=50, null=True + ) + venue = models.CharField(max_length=50, null=False, choices=Constants.venue) 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) - session_poster = models.ImageField(upload_to='gymkhana/session_poster', null=True) + end_time = models.TimeField(default=None, auto_now=False, null=False) + session_poster = models.ImageField(upload_to="gymkhana/session_poster", null=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, default="open") def __str__(self): return str(self.id) class Meta: - db_table = 'Session_info' + db_table = "Session_info" + class Event_info(models.Model): """ @@ -286,24 +292,24 @@ class Event_info(models.Model): """ id = models.AutoField(primary_key=True) - club = models.ForeignKey(Club_info, on_delete=models.CASCADE,max_length=50, null=True) - 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) + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, max_length=50, null=True + ) + 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) 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) + 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, default="open") def __str__(self): return str(self.id) class Meta: - db_table = 'Event_info' + db_table = "Event_info" class Club_report(models.Model): @@ -322,19 +328,22 @@ class Club_report(models.Model): """ id = models.AutoField(primary_key=True) - club = models.ForeignKey(Club_info, on_delete=models.CASCADE,max_length=50, null=False) - incharge = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE,max_length=256, null=False) + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, max_length=50, null=False + ) + incharge = models.ForeignKey( + ExtraInfo, on_delete=models.CASCADE, max_length=256, null=False + ) event_name = models.CharField(max_length=50, null=False) - date = models.DateTimeField( - max_length=50, default=timezone.now, blank=True) - event_details = models.FileField(upload_to='uploads/', null=False) + date = models.DateTimeField(max_length=50, default=timezone.now, blank=True) + event_details = models.FileField(upload_to="uploads/", null=False) description = models.TextField(max_length=256, null=True) def __str__(self): return str(self.id) class Meta: - db_table = 'Club_report' + db_table = "Club_report" class Fest_budget(models.Model): @@ -349,56 +358,57 @@ class Fest_budget(models.Model): description - brief explanation regarding budget if any status - wheather budget is approved or rejected remarks - negative things regarding budget - + """ id = models.AutoField(primary_key=True) fest = models.CharField(max_length=50, null=False, choices=Constants.fest) budget_amt = models.IntegerField(default=0, null=False) - budget_file = models.FileField(upload_to='uploads/', null=False) + budget_file = models.FileField(upload_to="uploads/", null=False) year = models.CharField(max_length=10, null=True) description = models.TextField(max_length=256, null=False) - status = models.CharField( - max_length=50, choices=Constants.status, default='open') + status = models.CharField(max_length=50, choices=Constants.status, default="open") remarks = models.CharField(max_length=256, null=True) def __str__(self): return str(self.id) class Meta: - db_table = 'Fest_budget' + db_table = "Fest_budget" class Other_report(models.Model): """ This model also stores details of the events conducting by all clubs irrespective of the clubs. - + id - serial number incharge - name of faculty who is incharge for the event date - date of the event event_details - for which purpose they are conducting the event - description - brief explanation about event if needed + description - brief explanation about event if needed """ + id = models.AutoField(primary_key=True) - incharge = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE,max_length=256, null=False) + incharge = models.ForeignKey( + ExtraInfo, on_delete=models.CASCADE, max_length=256, null=False + ) event_name = models.CharField(max_length=50, null=False) - date = models.DateTimeField( - max_length=50, default=timezone.now, blank=True) - event_details = models.FileField(upload_to='uploads/', null=False) + date = models.DateTimeField(max_length=50, default=timezone.now, blank=True) + event_details = models.FileField(upload_to="uploads/", null=False) description = models.TextField(max_length=256, null=True) def __str__(self): return str(self.id) class Meta: - db_table = 'Other_report' + db_table = "Other_report" class Change_office(models.Model): """ - + id - serial number club - name of the club @@ -410,15 +420,19 @@ class Change_office(models.Model): remarks - remarks if there are any. """ + id = models.AutoField(primary_key=True) - club = models.ForeignKey(Club_info, on_delete=models.CASCADE,max_length=50, null=False) - co_ordinator = models.ForeignKey(User, on_delete=models.CASCADE,null=False, related_name='co_of') + club = models.ForeignKey( + Club_info, on_delete=models.CASCADE, max_length=50, null=False + ) + co_ordinator = models.ForeignKey( + User, on_delete=models.CASCADE, null=False, related_name="co_of" + ) co_coordinator = models.ForeignKey( - User, on_delete=models.CASCADE, null=False, related_name='coco_of') - status = models.CharField( - max_length=50, choices=Constants.status, default='open') - date_request = models.DateTimeField( - max_length=50, default=timezone.now, blank=True) + User, on_delete=models.CASCADE, null=False, related_name="coco_of" + ) + status = models.CharField(max_length=50, choices=Constants.status, default="open") + date_request = models.DateTimeField(max_length=50, default=timezone.now, blank=True) date_approve = models.DateTimeField(max_length=50, blank=True) remarks = models.CharField(max_length=256, null=True) @@ -426,7 +440,7 @@ def __str__(self): return self.id class Meta: - db_table = 'Change_office' + db_table = "Change_office" class Voting_polls(models.Model): @@ -441,21 +455,23 @@ class Voting_polls(models.Model): 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) + + 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='{}') - + created_by = models.CharField(max_length=100, null=True) + groups = models.CharField(max_length=500, default="{}") + def groups_data(self): return self.groups def __str__(self): return self.title + class Meta: - ordering = ['-pub_date'] + ordering = ["-pub_date"] + class Voting_choices(models.Model): """ @@ -467,15 +483,16 @@ class Voting_choices(models.Model): """ 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='') + 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 - + class Meta: - get_latest_by = 'votes' + get_latest_by = "votes" + class Voting_voters(models.Model): """ @@ -485,11 +502,9 @@ class Voting_voters(models.Model): 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) - - + def __str__(self): return self.student_id - diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 7f54215bb..90c2c8e0b 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -473,7 +473,6 @@ def new_club(request): return redirect('/gymkhana/') - @login_required() def form_avail(request): """ @@ -988,8 +987,6 @@ def act_calender(request): return HttpResponse(content) - - @login_required def club_report(request): """ @@ -1106,7 +1103,6 @@ def change_head(request): # return redirect('/gymkhana/') - @login_required def new_session(request): """ @@ -1263,35 +1259,50 @@ def fest_budget(request): @login_required def approve(request): - """ - This view is used by the clubs to approve the students who wants to join the club and changes status of student to confirmed. - It gets a list of students who has to be approved and checks them and approves accordingly. - - @variables: - approve_list - list of students who has to be checked and approved. - remarks - gets remarks list if any remarks present - club_member - gets the object(club and student) and the confirms the status of student in the club. - """ - approve_list = list(request.POST.getlist('check')) - for user in approve_list: - # pos = lis.index(user) - remark = "remarks" + user - remarks = request.POST.getlist(remark) - user = user.split(',') - info = user[0].split(' - ') + """ + This view is used by the clubs to approve the students who want to join the club and changes the status of the student to 'confirmed'. + It gets a list of students who have to be approved and approves them accordingly. + """ + approve_list = list(request.POST.getlist("check")) + + for user in approve_list: + remark = "remarks" + user + remarks = request.POST.getlist(remark) + user = user.split(",") + info = user[0].split(" - ") + + # Retrieve User, ExtraInfo, and Student objects + user_name = get_object_or_404(User, username=info[1]) + extra1 = get_object_or_404(ExtraInfo, id=info[0], user=user_name) + student = get_object_or_404(Student, id=extra1) + + # Check if the user is already a member of the club + existing_club_member = Club_member.objects.filter( + club=user[1], member=student + ).first() + + if existing_club_member: + # If the user is already a member, update the existing entry and delete past entry + existing_club_member.status = "confirmed" + existing_club_member.remarks = remarks[0] + existing_club_member.save() + + # Delete past entries + Club_member.objects.filter(club=user[1], member=student).exclude( + id=existing_club_member.id + ).delete() + + else: + # If the user is not already a member, create a new entry + new_club_member = Club_member.objects.create( + club=user[1], member=student, status="confirmed", remarks=remarks[0] + ) + new_club_member.save() + + messages.success(request, "Successfully Approved !!!") + + return redirect("/gymkhana/") - # getting queryset class objects - user_name = get_object_or_404(User, username=info[1]) - 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.status = "confirmed" - club_member.remarks = remarks[0] - club_member.save() - messages.success(request, "Successfully Approved !!!") - - return redirect('/gymkhana/') @login_required def club_approve(request): @@ -1450,7 +1461,7 @@ def date_events(request): return HttpResponse(dates) return HttpResponse("Hurray") -#this algorithm checks if the passed slot time coflicts with any of already booked sessions +# this algorithm checks if the passed slot time coflicts with any of already booked sessions def conflict_algorithm_session(date, start_time, end_time, venue): #converting string to datetime type variable """ @@ -1628,7 +1639,7 @@ def delete_poll(request, poll_id): return redirect('/gymkhana/') -#this algorithm checks if the passed slot time coflicts with any of already booked events +# this algorithm checks if the passed slot time coflicts with any of already booked events def conflict_algorithm_event(date, start_time, end_time, venue): """ @@ -1654,7 +1665,7 @@ def conflict_algorithm_event(date, start_time, end_time, venue): #placing start time and end time in tuple fashion inside this list slots = [(start_time, end_time)] for value in booked_Events: - slots.append((value.start_time, value.end_time)) + slots.append((value.start_time, value.end_time)) slots.sort() #if there isn't any slot present for the selected day just book the event if (len(slots) == 1): @@ -1719,8 +1730,6 @@ def filetracking(request): ) if 'send' in request.POST: - - uploader = request.user.extrainfo logger.info(uploader) #ref_id = request.POST.get('fileid') @@ -1740,14 +1749,10 @@ def filetracking(request): designation=designation, upload_file=upload_file ) - - current_id = request.user.extrainfo remarks = request.POST.get('remarks') - sender = request.POST.get('design') current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) - receiver = request.POST.get('receiver') receiver_id = User.objects.get(username=receiver) logger.info("Receiver_id = ") @@ -1772,13 +1777,10 @@ def filetracking(request): ) office_module_notif(request.user, receiver_id) messages.success(request,'File sent successfully') - except IntegrityError: message = "FileID Already Taken.!!" return HttpResponse(message) - - file = File.objects.select_related('uploader','uploader__user','uploader__department','designation').all() extrainfo = ExtraInfo.objects.select_related('user','department').all() holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() @@ -1869,6 +1871,3 @@ def forward(request, id): } return render(request, 'filetracking/forward.html', context) - - - diff --git a/FusionIIIT/applications/iwdModuleV2/urls.py b/FusionIIIT/applications/iwdModuleV2/urls.py index 6ad401098..c3ab9169a 100644 --- a/FusionIIIT/applications/iwdModuleV2/urls.py +++ b/FusionIIIT/applications/iwdModuleV2/urls.py @@ -5,8 +5,6 @@ app_name = 'iwdModuleV2' urlpatterns = [ - - url(r'^$', views.dashboard, name='IWD Dashboard'), url(r'^page1_1/$', views.page1_1, name='IWD Page1.1'), url(r'page2_1/$', views.page2_1, name='IWD Page2.1'), diff --git a/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20240115_1651.py new file mode 100644 index 000000000..316444b58 --- /dev/null +++ b/FusionIIIT/applications/programme_curriculum/migrations/0002_auto_20240115_1651.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2024-01-15 16:51 + +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=2024), + ), + migrations.AlterField( + model_name='programme', + name='programme_begin_year', + field=models.PositiveIntegerField(default=2024), + ), + ] diff --git a/FusionIIIT/applications/scholarships/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/scholarships/migrations/0002_auto_20240115_1651.py new file mode 100644 index 000000000..be534c660 --- /dev/null +++ b/FusionIIIT/applications/scholarships/migrations/0002_auto_20240115_1651.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-01-15 16:51 + +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=2024), + ), + ] diff --git a/FusionIIIT/templates/gymkhanaModule/active_poll.html b/FusionIIIT/templates/gymkhanaModule/active_poll.html index 38868f58e..d5bee5b50 100644 --- a/FusionIIIT/templates/gymkhanaModule/active_poll.html +++ b/FusionIIIT/templates/gymkhanaModule/active_poll.html @@ -1,9 +1,9 @@ -{% load voters_tag %} {% block active_poll %} +{% block active_poll %}
- {% for poll in voting_polls %} {% validate request.user poll.groups as car%} - {% if car %} -
+ {% for poll in voting_polls %} {% comment %} {% if + request.user.groups.filter(name__in=poll.groups).exists %} {% endcomment %} +
-

- {{poll.title}} -

- - {% if poll.exp_date == 'expire' %} -

Expired

+

{{poll.title}}

+ {% if poll.exp_date > now %} +

Expired

{% else %} -

Expires in: {{poll.exp_date}} Days

+

Expires in: {{poll.exp_date}} Days

{% endif %}
-
- {% csrf_token %} {% if poll.exp_date == 'expire' %} + {% csrf_token %} {% if poll.exp_date > now %}

Results

-

{{poll.max}}

+

{{poll.max}}

{% else %} {% for choice in poll.choices %}
{{choice.title}}
@@ -66,7 +62,6 @@
{% endfor %} {% endif %} -
@@ -74,7 +69,7 @@ - {% elif roll in poll.voters %} + {% elif request.user in poll.voters %} @@ -83,7 +78,7 @@ {% endif %}
-

+

Created By: {{poll.created_by.0}}, {{poll.created_by.1}}

@@ -92,7 +87,7 @@
- {% endif %} {% endfor %} + {% comment %} {% endif %} {% endcomment %} {% endfor %}
- {% endblock active_poll %} diff --git a/FusionIIIT/templates/gymkhanaModule/create_poll.html b/FusionIIIT/templates/gymkhanaModule/create_poll.html index 81e2c8f9f..f306940d7 100644 --- a/FusionIIIT/templates/gymkhanaModule/create_poll.html +++ b/FusionIIIT/templates/gymkhanaModule/create_poll.html @@ -19,28 +19,28 @@

Poll Information

@@ -52,7 +52,7 @@

Poll Information

Choices

@@ -60,14 +60,14 @@

Choices

From a4479fabb1d2cf662fac5d5b323e5bbaf95360b4 Mon Sep 17 00:00:00 2001 From: RishabhSharma96 <114917946+RishabhSharma96@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:47:36 +0530 Subject: [PATCH 03/27] removed conflicts from approve request from dean --- .../templates/gymkhanaModule/clubsessions.html | 0 .../templates/gymkhanaModule/gymkhana.html | 16 ++++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 FusionIIIT/templates/gymkhanaModule/clubsessions.html diff --git a/FusionIIIT/templates/gymkhanaModule/clubsessions.html b/FusionIIIT/templates/gymkhanaModule/clubsessions.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/FusionIIIT/templates/gymkhanaModule/gymkhana.html b/FusionIIIT/templates/gymkhanaModule/gymkhana.html index bedfe767f..141ac70b9 100644 --- a/FusionIIIT/templates/gymkhanaModule/gymkhana.html +++ b/FusionIIIT/templates/gymkhanaModule/gymkhana.html @@ -355,19 +355,23 @@ Update Activity Calender - - + + + - + + + Submit Event report To Convener From 6361945b99ebe575aa52b8a0fcd22a76983ed6cc Mon Sep 17 00:00:00 2001 From: Rishabh Sharma <114917946+RishabhSharma96@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:55:28 +0530 Subject: [PATCH 04/27] removed conflicts from approve request from dean (#4) --- .../templates/gymkhanaModule/clubsessions.html | 0 .../templates/gymkhanaModule/gymkhana.html | 16 ++++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 FusionIIIT/templates/gymkhanaModule/clubsessions.html diff --git a/FusionIIIT/templates/gymkhanaModule/clubsessions.html b/FusionIIIT/templates/gymkhanaModule/clubsessions.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/FusionIIIT/templates/gymkhanaModule/gymkhana.html b/FusionIIIT/templates/gymkhanaModule/gymkhana.html index bedfe767f..141ac70b9 100644 --- a/FusionIIIT/templates/gymkhanaModule/gymkhana.html +++ b/FusionIIIT/templates/gymkhanaModule/gymkhana.html @@ -355,19 +355,23 @@ Update Activity Calender - - + + + - + + + Submit Event report To Convener From f76c737168d592f10b1c6333415bd90312df7311 Mon Sep 17 00:00:00 2001 From: RishabhSharma96 <114917946+RishabhSharma96@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:46:15 +0530 Subject: [PATCH 05/27] change co and coco api working --- FusionIIIT/applications/gymkhana/views.py | 60 ++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 90c2c8e0b..4f38f06b4 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1041,20 +1041,19 @@ def change_head(request): And adds to the database. @param: - request - trivial + request - trivial @variables: - - club - name of the club - co_ordinator - new co_ordinator of the club - co_coordinator - new co_cordinator of the club - date - date at which the heads of the clubs changes - time - time at which the heads changes - desc - description on change of heads - old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator - old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator - new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator - new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator + club - name of the club + co_ordinator - new co_ordinator of the club + co_coordinator - new co_cordinator of the club + date - date at which the heads of the clubs changes + time - time at which the heads changes + desc - description on change of heads + old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator + old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator + new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator + new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator """ if request.method == "POST": @@ -1063,44 +1062,49 @@ def change_head(request): co_coordinator = request.POST.get('coco') date = request.POST.get("date") time = request.POST.get("time") - desc = "co-ordinator and co co-ordinator changed on "+date+" at "+time + desc = f"co-ordinator and co co-ordinator changed on {date} at {time}" message = "" - # club_name = get_object_or_404(Club_info, club_name=club) - co_ordinator_student = get_object_or_404(Student, id__user__username=co_ordinator) - co_coordinator_student = get_object_or_404(Student, id__user__username=co_coordinator) - club_info = get_object_or_404(Club_info, club_name=club) old_co_ordinator = club_info.co_ordinator old_co_coordinator = club_info.co_coordinator + club_info.co_ordinator = co_ordinator_student club_info.co_coordinator = co_coordinator_student club_info.save() message += "Successfully changed !!!" - - 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() - 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_ordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_ordinator, designation__name="co-ordinator") - old_co_ordinator.delete() - old_co_coordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_coordinator, designation__name="co co-ordinator") - old_co_coordinator.delete() + HoldsDesignation.objects.filter(user__username=old_co_ordinator, designation__name="co-ordinator").delete() + HoldsDesignation.objects.filter(user__username=old_co_coordinator, designation__name="co co-ordinator").delete() content = { - 'status':"success", - 'message':message, - } + 'status': "success", + 'message': message, + } content = json.dumps(content) return HttpResponse(content) - # return redirect('/gymkhana/') + # Handle non-POST requests or redirect if needed + # return redirect('/gymkhana/') @login_required From 3168445e21d5da72ef88d8f14440569cade0bd66 Mon Sep 17 00:00:00 2001 From: Rishabh Sharma <114917946+RishabhSharma96@users.noreply.github.com> Date: Sat, 17 Feb 2024 15:09:33 +0530 Subject: [PATCH 06/27] Error fix:Change co and coco api now working (#5) * removed conflicts from approve request from dean * change co and coco api working --- FusionIIIT/applications/gymkhana/views.py | 60 ++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 90c2c8e0b..4f38f06b4 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1041,20 +1041,19 @@ def change_head(request): And adds to the database. @param: - request - trivial + request - trivial @variables: - - club - name of the club - co_ordinator - new co_ordinator of the club - co_coordinator - new co_cordinator of the club - date - date at which the heads of the clubs changes - time - time at which the heads changes - desc - description on change of heads - old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator - old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator - new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator - new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator + club - name of the club + co_ordinator - new co_ordinator of the club + co_coordinator - new co_cordinator of the club + date - date at which the heads of the clubs changes + time - time at which the heads changes + desc - description on change of heads + old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator + old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator + new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator + new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator """ if request.method == "POST": @@ -1063,44 +1062,49 @@ def change_head(request): co_coordinator = request.POST.get('coco') date = request.POST.get("date") time = request.POST.get("time") - desc = "co-ordinator and co co-ordinator changed on "+date+" at "+time + desc = f"co-ordinator and co co-ordinator changed on {date} at {time}" message = "" - # club_name = get_object_or_404(Club_info, club_name=club) - co_ordinator_student = get_object_or_404(Student, id__user__username=co_ordinator) - co_coordinator_student = get_object_or_404(Student, id__user__username=co_coordinator) - club_info = get_object_or_404(Club_info, club_name=club) old_co_ordinator = club_info.co_ordinator old_co_coordinator = club_info.co_coordinator + club_info.co_ordinator = co_ordinator_student club_info.co_coordinator = co_coordinator_student club_info.save() message += "Successfully changed !!!" - - 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() - 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_ordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_ordinator, designation__name="co-ordinator") - old_co_ordinator.delete() - old_co_coordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_coordinator, designation__name="co co-ordinator") - old_co_coordinator.delete() + HoldsDesignation.objects.filter(user__username=old_co_ordinator, designation__name="co-ordinator").delete() + HoldsDesignation.objects.filter(user__username=old_co_coordinator, designation__name="co co-ordinator").delete() content = { - 'status':"success", - 'message':message, - } + 'status': "success", + 'message': message, + } content = json.dumps(content) return HttpResponse(content) - # return redirect('/gymkhana/') + # Handle non-POST requests or redirect if needed + # return redirect('/gymkhana/') @login_required From bb97dd3989ffdd56689913908d8b273aef6e135f Mon Sep 17 00:00:00 2001 From: Anushri Thakre <121868449+ast008@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:56:19 +0530 Subject: [PATCH 07/27] Update serializers.py --- .../applications/gymkhana/api/serializers.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 57a7434f8..83682920f 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -2,9 +2,14 @@ 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 +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 +class Voting_choicesSerializer(serializers.ModelSerializer): + class Meta: + model = Voting_choices + fields = ['poll_event', 'title', 'description', 'votes'] + class Club_infoSerializer(serializers.ModelSerializer): class Meta: @@ -25,7 +30,7 @@ class Core_teamSerializer(serializers.ModelSerializer): class Meta: model=Core_team - fields=('_all_') + fields=('all') class Club_DetailsSerializer(serializers.ModelSerializer): class Meta: @@ -35,13 +40,18 @@ class Meta: class Session_infoSerializer(serializers.ModelSerializer): class Meta: model = Session_info - fields= ['venue','date','start_time','details'] + fields = [ 'venue', 'date', 'start_time', 'end_time', 'details','status'] + +class Club_memberSerializer(serializers.ModelSerializer): + class Meta: + model = Club_member + fields = ['member','club','description', 'status','remarks'] class event_infoserializer(serializers.ModelSerializer): class Meta: model=Event_info - fields=['club','event_name','incharge','date'] + fields=['club','event_name','incharge','date','venue','start_time','end_time','details'] class club_budgetserializer(serializers.ModelSerializer): From 26ed6565c3456c40d1c73ab1d7cf9c9c167a26d7 Mon Sep 17 00:00:00 2001 From: Anushri Thakre <121868449+ast008@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:56:53 +0530 Subject: [PATCH 08/27] Update views.py --- FusionIIIT/applications/gymkhana/api/views.py | 338 +++++++++++++++++- 1 file changed, 336 insertions(+), 2 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 194d7c503..50bb4c1a1 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -1,3 +1,5 @@ +import json +from venv import logger from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication from rest_framework import status @@ -6,10 +8,91 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from django.shortcuts import render -from applications.gymkhana.models import 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_infoSerializer,Club_DetailsSerializer,Session_infoSerializer,event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer,Voting_pollSerializer +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_infoSerializer,Club_DetailsSerializer,Session_infoSerializer, Voting_choicesSerializer,event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer,Voting_pollSerializer from django.contrib.auth.models import User +from applications.gymkhana.views import * +class ActCalendarAPIView(APIView): + """ + API endpoint to upload the activity calendar of a club. + """ + + def post(self, request): + """ + Handles POST requests to upload the activity calendar. + """ + try: + # Getting form data + club = request.data.get("club") + act_calender = request.FILES.get("act_file") + act_calender.name = f"{club}_act_calender.pdf" + + # Update club's activity calendar + club_info = get_object_or_404(Club_info, club_name=club) + club_info.activity_calender = act_calender + club_info.save() + + message = f"Successfully uploaded the calendar for {club} !!!" + + # Prepare response JSON + content = { + 'status': "success", + 'message': message, + } + return Response(content, status=201) # HTTP 201 Created + except Exception as e: + error_message = "Some error occurred" + logger.error(f"Error in uploading activity calendar: {e}") + content = { + 'status': "error", + 'message': error_message, + } + return Response(content, status=500) +class RegistrationFormAPIView(APIView): + """ + API endpoint to handle registration form submissions. + """ + + def post(self, request): + """ + Handles POST requests to save registration form data. + """ + try: + # Getting form data + user_name = request.data.get("user_name") + print(user_name) + roll = request.data.get("roll") + cpi = request.data.get("cpi") + 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) + try: + registration.save() + # 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}") + + 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) + def coordinator_club(request): club_info = [] for i in Club_info.objects.all(): @@ -26,6 +109,8 @@ def get(self,request): serializer=Core_teamSerializer(co, many=True) print(serializer.data) return Response(serializer.data) + + class clubname(APIView): permission_classes = [IsAuthenticated] @@ -87,3 +172,252 @@ def get(self,respect): votingpolls=Voting_polls.objects.all() serializer=Voting_pollSerializer(votingpolls, many=True) return Response(serializer.data) + +class ClubMemberAPIView(APIView): + def get(self, request): + club_members = Club_member.objects.all() + serializer = Club_memberSerializer(club_members, many=True) + return Response(serializer.data) + +class VotingPollAPIView(APIView): + """ + API endpoint to create a new voting poll. + """ + + def post(self, request): + """ + This method handles POST requests to create a new voting poll. + """ + try: + # Initialize serializers + poll_serializer = Voting_pollSerializer(data=request.data) + choices_serializer = Voting_choicesSerializer(data=request.data.get('choices'), many=True) + + # Validate both serializers + poll_valid = poll_serializer.is_valid() + choices_valid = choices_serializer.is_valid() + + if poll_valid and choices_valid: + # Save the validated data + poll_instance = poll_serializer.save() + + # Save choices associated with the poll + choices_serializer.save(poll_event=poll_instance) + + # Print success message + print("Voting poll created successfully") + + # Redirect to a different URL only if necessary + # Modify this logic based on your requirements + if request.accepted_renderer.format == 'html': + return redirect('/gymkhana/') + else: + # Return serialized poll data along with choices + poll_data = poll_serializer.data + poll_data['choices'] = choices_serializer.data + return Response(poll_data, status=status.HTTP_201_CREATED) + else: + # If serializer validation fails, return errors + errors = {} + if not poll_valid: + errors['poll_errors'] = poll_serializer.errors + if not choices_valid: + errors['choices_errors'] = choices_serializer.errors + print(errors) # Log errors to console + return Response(errors, status=status.HTTP_400_BAD_REQUEST) + except Exception as e: + # Log any exceptions that occur during the process + print("Exception occurred:", str(e)) + return Response({"error": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +##logger = logging.getLogger(_NamedFuncPointer) + +class NewSessionAPIView(APIView): + """ + API endpoint to create a new session for a club. + """ + + def post(self, request): + """ + Handle POST requests to create a new session. + """ + try: + serializer = Session_infoSerializer(data=request.data) + if serializer.is_valid(): + # Save the validated data + session_instance = serializer.save() + + # Check for conflicts with existing sessions + result = conflict_algorithm_session(session_instance.date, + session_instance.start_time, + session_instance.end_time, + session_instance.venue) + if result == "success": + # Notify users about the new session + getstudents = ExtraInfo.objects.select_related('user', 'department').filter(user_type='student') + recipients = User.objects.filter(extrainfo__in=getstudents) + gymkhana_session(request.user, recipients, 'new_session', session_instance.club, + session_instance.details, session_instance.venue) + + # Print success message + print("Session booked successfully") + + # Redirect to a different URL only if necessary + # Modify this logic based on your requirements + if request.accepted_renderer.format == 'html': + return redirect('/gymkhana/') + else: + return Response(serializer.data, status=status.HTTP_201_CREATED) + else: + return Response({"error": "The selected time slot for the given date and venue conflicts with an already booked session"}, + status=status.HTTP_409_CONFLICT) + else: + # If serializer validation fails, return errors + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + except Exception as e: + # Log any exceptions that occur during the process + logger.exception("Exception occurred: %s", str(e)) + return Response({"error": "Some error occurred"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class DeleteEventsView(APIView): + """ + API endpoint to delete events. + """ + + def post(self, request): + """ + Handle POST requests to delete events. + """ + try: + events_deleted = [] + events_not_found = [] + + # Ensure that request.data is a dictionary + event_data_list = request.data if isinstance(request.data, list) else [] + + for event_data in event_data_list: + name = event_data.get('event_name') + venue = event_data.get('venue') + incharge = event_data.get('incharge') + date = event_data.get('date') + + # Query Event_info based on the provided parameters + event = Event_info.objects.filter( + event_name=name, + venue=venue, + incharge=incharge, + date=date + ).first() + + if event: + event.delete() + events_deleted.append(event_data) + else: + events_not_found.append(event_data) + + response_data = { + "events_deleted": events_deleted, + "events_not_found": events_not_found + } + + return Response(response_data, status=status.HTTP_200_OK) + except Exception as e: + return Response(str(e), status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + + +class DeleteSessionsView(APIView): + """ + API endpoint to delete sessions. + """ + + def post(self, request): + """ + Handle POST requests to delete sessions. + """ + try: + # Get the list of session data from the request + session_data_list = json.loads(request.body) + + sessions_deleted = [] + sessions_not_found = [] + + # 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') + details = session_data.get('details') + + # Query Session_info based on the provided parameters + session = Session_info.objects.filter( + venue=venue, + date=date, + start_time=start_time, + end_time=end_time, + details=details + ).first() + + if session: + session.delete() + sessions_deleted.append(session_data) + else: + sessions_not_found.append(session_data) + + response_data = { + "sessions_deleted": sessions_deleted, + "sessions_not_found": sessions_not_found + } + + return JsonResponse(response_data, status=200) + except Exception as e: + return JsonResponse({"error": str(e)}, status=500) + + + + +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) + 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 NewEventAPIView(APIView): + 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 AddMemberToClub(APIView): + def post(self, request): + serializer = Club_memberSerializer(data=request.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) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) From a2576df10222a42078d813adf31f5a5a8791753b Mon Sep 17 00:00:00 2001 From: Anushri Thakre <121868449+ast008@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:57:31 +0530 Subject: [PATCH 09/27] Update urls.py --- FusionIIIT/applications/gymkhana/urls.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 308ce4d7b..f67e036ff 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns -from applications.gymkhana.api.views import Voting_Polls +from applications.gymkhana.api.views import AddMemberToClub, ClubMemberAPIView, DeleteEventsView, DeleteSessionsView, NewEventAPIView, NewSessionAPIView, Voting_Polls 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 . import views @@ -29,14 +29,19 @@ url(r'^voting_polls/$',Voting_Polls.as_view()), # api for "voting_polls" method="get" with TokenAuthentication + url(r'^api/new_event/$',NewEventAPIView.as_view(), name='new_event_api'), + url(r'^api/club_membership/$', AddMemberToClub.as_view(), name='new_club_member'), - + url(r'^api/delete_event/$', DeleteEventsView.as_view(), name='delete_events_api'), + url(r'^api/delete_sessions/$', DeleteSessionsView.as_view(), name='delete_sessions_api'), + url(r'^api/new_session/$',NewSessionAPIView.as_view(), name='new_session_api'), url(r'^clubname/$', clubname.as_view()), url(r'^$', views.gymkhana, name='gymkhana'), url(r'^delete_requests/$', views.delete_requests, name='delete_requests'), url(r'^form_avail/$', views.form_avail, name='form_avail'), url(r'^registration_form/$', views.registration_form, name='registration_form'), url(r'^new_club/$', views.new_club, name='new_club'), + url(r'^api/members_records/$', ClubMemberAPIView.as_view(), name='club_members'), #club_head url(r'^approve/$', views.approve, name='approve'), From d3e91ddb5d71220e7695cbd352f1ae3d5e4e3fc5 Mon Sep 17 00:00:00 2001 From: "Puliuvarthi.Mahesh" <134507390+MaheshPulivarthi18@users.noreply.github.com> Date: Sun, 18 Feb 2024 12:20:33 +0530 Subject: [PATCH 10/27] New feature: new club approval form fixed (#6) * use cases init * club approoval request to dean working --- .../migrations/0002_auto_20240115_1651.py | 18 ----- .../migrations/0003_auto_20240210_1752.py | 18 ----- .../migrations/0004_auto_20240212_1537.py | 18 ----- .../migrations/0005_auto_20240212_2152.py | 18 ----- .../migrations/0006_auto_20240212_2215.py | 18 ----- .../migrations/0007_auto_20240213_0036.py | 18 ----- .../migrations/0008_auto_20240213_1739.py | 18 ----- .../migrations/0009_auto_20240214_1648.py | 18 ----- .../migrations/0010_auto_20240214_1808.py | 19 ----- FusionIIIT/applications/globals/models.py | 2 +- .../migrations/0003_auto_20240216_1824.py | 24 ++++++ .../migrations/0004_auto_20240216_1907.py | 23 ++++++ .../migrations/0005_auto_20240216_1929.py | 19 +++++ .../migrations/0006_auto_20240217_1530.py | 19 +++++ FusionIIIT/applications/gymkhana/models.py | 8 +- .../gymkhana/templatetags/voters_tag.py | 16 ++-- FusionIIIT/applications/gymkhana/views.py | 80 ++++++++++--------- .../templates/gymkhanaModule/active_poll.html | 4 +- .../gymkhanaModule/approvalrequests.html | 18 ++++- .../templates/gymkhanaModule/create_poll.html | 4 +- 20 files changed, 163 insertions(+), 217 deletions(-) delete mode 100644 FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py delete mode 100644 FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py delete mode 100644 FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py delete mode 100644 FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py delete mode 100644 FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py delete mode 100644 FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py delete mode 100644 FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py delete mode 100644 FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py delete mode 100644 FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0003_auto_20240216_1824.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0004_auto_20240216_1907.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0005_auto_20240216_1929.py create mode 100644 FusionIIIT/applications/gymkhana/migrations/0006_auto_20240217_1530.py diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py b/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py deleted file mode 100644 index e7c68233d..000000000 --- a/FusionIIIT/applications/globals/migrations/0002_auto_20240115_1651.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-01-15 16:51 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py b/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py deleted file mode 100644 index 50441b81b..000000000 --- a/FusionIIIT/applications/globals/migrations/0003_auto_20240210_1752.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-10 17:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0002_auto_20240115_1651'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py b/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py deleted file mode 100644 index 0e5541cb3..000000000 --- a/FusionIIIT/applications/globals/migrations/0004_auto_20240212_1537.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-12 15:37 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0003_auto_20240210_1752'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py b/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py deleted file mode 100644 index e5cb98c49..000000000 --- a/FusionIIIT/applications/globals/migrations/0005_auto_20240212_2152.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-12 21:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0004_auto_20240212_1537'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py b/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py deleted file mode 100644 index ab252a31d..000000000 --- a/FusionIIIT/applications/globals/migrations/0006_auto_20240212_2215.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-12 22:15 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0005_auto_20240212_2152'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py b/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py deleted file mode 100644 index f5984571a..000000000 --- a/FusionIIIT/applications/globals/migrations/0007_auto_20240213_0036.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-13 00:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0006_auto_20240212_2215'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py b/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py deleted file mode 100644 index e710bc7c6..000000000 --- a/FusionIIIT/applications/globals/migrations/0008_auto_20240213_1739.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-13 17:39 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0007_auto_20240213_0036'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py b/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py deleted file mode 100644 index f935078e8..000000000 --- a/FusionIIIT/applications/globals/migrations/0009_auto_20240214_1648.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-14 16:48 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0008_auto_20240213_1739'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='user_status', - field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), - ), - ] diff --git a/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py b/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py deleted file mode 100644 index 00b23336e..000000000 --- a/FusionIIIT/applications/globals/migrations/0010_auto_20240214_1808.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.1.5 on 2024-02-14 18:08 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('globals', '0009_auto_20240214_1648'), - ] - - operations = [ - migrations.AlterField( - model_name='extrainfo', - name='department', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='globals.departmentinfo'), - ), - ] diff --git a/FusionIIIT/applications/globals/models.py b/FusionIIIT/applications/globals/models.py index ba982a0e1..31eedcfb4 100644 --- a/FusionIIIT/applications/globals/models.py +++ b/FusionIIIT/applications/globals/models.py @@ -149,7 +149,7 @@ class ExtraInfo(models.Model): phone_no = models.BigIntegerField(null=True, default=9999999999) user_type = models.CharField(max_length=20, choices=Constants.USER_CHOICES) department = models.ForeignKey( - DepartmentInfo, on_delete=models.CASCADE, null=False, blank=True) + DepartmentInfo, on_delete=models.CASCADE, null=True, blank=True) profile_picture = models.ImageField( null=True, blank=True, upload_to='globals/profile_pictures') about_me = models.TextField(default='NA', max_length=1000, blank=True) diff --git a/FusionIIIT/applications/gymkhana/migrations/0003_auto_20240216_1824.py b/FusionIIIT/applications/gymkhana/migrations/0003_auto_20240216_1824.py new file mode 100644 index 000000000..ed9247870 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0003_auto_20240216_1824.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.5 on 2024-02-16 18:24 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0002_auto_20240214_1808'), + ] + + operations = [ + migrations.AlterField( + model_name='club_info', + name='created_on', + field=models.DateField(default=django.utils.timezone.now), + ), + migrations.AlterField( + model_name='club_info', + name='head_changed_on', + field=models.DateField(default=django.utils.timezone.now), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0004_auto_20240216_1907.py b/FusionIIIT/applications/gymkhana/migrations/0004_auto_20240216_1907.py new file mode 100644 index 000000000..61562cfa7 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0004_auto_20240216_1907.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2024-02-16 19:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0003_auto_20240216_1824'), + ] + + operations = [ + migrations.AlterField( + model_name='club_info', + name='created_on', + field=models.DateField(default=None, null=True), + ), + migrations.AlterField( + model_name='club_info', + name='head_changed_on', + field=models.DateField(default=None, null=True), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0005_auto_20240216_1929.py b/FusionIIIT/applications/gymkhana/migrations/0005_auto_20240216_1929.py new file mode 100644 index 000000000..58c86dd7a --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0005_auto_20240216_1929.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.5 on 2024-02-16 19:29 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0004_auto_20240216_1907'), + ] + + operations = [ + migrations.AlterField( + model_name='club_info', + name='created_on', + field=models.DateField(default=django.utils.timezone.now, null=True), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/migrations/0006_auto_20240217_1530.py b/FusionIIIT/applications/gymkhana/migrations/0006_auto_20240217_1530.py new file mode 100644 index 000000000..94e6ecab3 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0006_auto_20240217_1530.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.5 on 2024-02-17 15:30 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0005_auto_20240216_1929'), + ] + + operations = [ + migrations.AlterField( + model_name='club_info', + name='head_changed_on', + field=models.DateField(default=django.utils.timezone.now, null=True), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index caaf126bb..4fa64b432 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -66,7 +66,7 @@ class Club_info(models.Model): spent_budget - the amount spent by the club avail_budget - the amount available at the club status - status of club wheather it is confirmed or not - + """ club_name = models.CharField(max_length=50, null=False, primary_key=True) @@ -93,8 +93,8 @@ class Club_info(models.Model): spent_budget = models.IntegerField(null=True, default=0) avail_budget = models.IntegerField(null=True, default=0) status = models.CharField(max_length=50, choices=Constants.status, default="open") - head_changed_on = models.DateField(default=None, auto_now=False, null=False) - created_on = models.DateField(default=None, auto_now=False, null=False) + head_changed_on = models.DateField(default=timezone.now, auto_now=False, null=True) + created_on = models.DateField(default=timezone.now, auto_now=False, null=True) def __str__(self): return str(self.club_name) @@ -222,6 +222,7 @@ class Club_budget(models.Model): budget_file - it is file which contains complete details regarding the amount they want to spend descrion - description about the budget if any """ + id = models.AutoField(primary_key=True) club = models.ForeignKey( Club_info, on_delete=models.CASCADE, max_length=50, null=False @@ -254,6 +255,7 @@ class Session_info(models.Model): details - for which purpose they are taking the session status - wheather it is approved/rejected. """ + id = models.AutoField(primary_key=True) club = models.ForeignKey( Club_info, on_delete=models.CASCADE, max_length=50, null=True diff --git a/FusionIIIT/applications/gymkhana/templatetags/voters_tag.py b/FusionIIIT/applications/gymkhana/templatetags/voters_tag.py index 408e7b643..61e354a6f 100644 --- a/FusionIIIT/applications/gymkhana/templatetags/voters_tag.py +++ b/FusionIIIT/applications/gymkhana/templatetags/voters_tag.py @@ -1,27 +1,29 @@ from django import template import re + register = template.Library() toggel = False + ## A tag function to find whether to show the poll to the user or not @register.simple_tag def validate(user, groups): - - roll = user.username[:4] + roll = user.username[:3] branch = user.extrainfo.department.name print(groups) if roll in groups.keys(): - if groups[roll][0] == 'All': + if groups[roll][0] == "All": return True else: if branch in groups[roll]: - return True + return True else: - return False + return False else: return False - + + @register.simple_tag def result(): - return toggel \ No newline at end of file + return toggel diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 4f38f06b4..25a3354d0 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -989,7 +989,7 @@ def act_calender(request): @login_required def club_report(request): - """ + """ This function is used to add the details of the club event along with a report. It adds the club event details to the database. And also uploads report file. @@ -1007,31 +1007,32 @@ def club_report(request): report - the club_report file on the event uploads by the user who adds data """ - if request.method == 'POST' and request.FILES['report']: - # getting form data - club = request.POST.get('club') - user = request.POST.get("s_inc") - event = request.POST.get("event") - d_d = request.POST.get("d_d") - date = request.POST.get("date") - time = request.POST.get("time") - report = request.FILES["report"] - report.name = club+"_"+event+"_report" - - # 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[0], user=user_name) - - club_name = get_object_or_404(Club_info, club_name=club) - - # saving data to the database - club_report = Club_report(club=club_name, incharge=extra, event_name=event, + if request.method == 'POST' and request.FILES['report']: + # getting form data + club = request.POST.get('club') + user = request.POST.get("s_inc") + event = request.POST.get("event") + d_d = request.POST.get("d_d") + date = request.POST.get("date") + time = request.POST.get("time") + report = request.FILES["report"] + report.name = club+"_"+event+"_report" + + # 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[0], user=user_name) + + club_name = get_object_or_404(Club_info, club_name=club) + + # saving data to the database + club_report = Club_report(club=club_name, incharge=extra, event_name=event, date=date+" "+time, event_details=report, description=d_d) - club_report.save() - messages.success(request, "Successfully updated the report !!!") + club_report.save() + messages.success(request, "Successfully updated the report !!!") + + return redirect('/gymkhana/') - return redirect('/gymkhana/') @login_required def change_head(request): @@ -1106,7 +1107,6 @@ def change_head(request): # Handle non-POST requests or redirect if needed # return redirect('/gymkhana/') - @login_required def new_session(request): """ @@ -1310,23 +1310,27 @@ def approve(request): @login_required def club_approve(request): - """ + """ This view is used by the administration to approve the clubs. - It gets a list of clubs and then approves if they want to. + It gets a list of clubs and then approves if they want to. - @variables: - club_approve_list - list of clubs which has to be approved - club_name - gets the object and then confirms the club + @variables: + club_approve_list - list of clubs which has to be approved + club_name - gets the object and then confirms the club - """ - club_approve_list = list(request.POST.getlist('check')) - for club in club_approve_list: - club_name = get_object_or_404(Club_info, club_name=club) - club_name.status = "confirmed" - club_name.save() - messages.success(request, "Successfully Approved !!!") + """ + if request.method == "POST": + club_approve_list = request.POST.getlist("check") + for club in club_approve_list: + club_name = get_object_or_404(Club_info, club_name=club) + club_name.status = "confirmed" + club_name.created_on = timezone.now() + club_name.save() + messages.success( + request, f"Successfully approved {club_name.club_name} club." + ) - return redirect('/gymkhana/') + return redirect("/gymkhana/") @login_required diff --git a/FusionIIIT/templates/gymkhanaModule/active_poll.html b/FusionIIIT/templates/gymkhanaModule/active_poll.html index d5bee5b50..26570f47b 100644 --- a/FusionIIIT/templates/gymkhanaModule/active_poll.html +++ b/FusionIIIT/templates/gymkhanaModule/active_poll.html @@ -1,8 +1,8 @@ {% block active_poll %}
- {% for poll in voting_polls %} {% comment %} {% if - request.user.groups.filter(name__in=poll.groups).exists %} {% endcomment %} + {% for poll in voting_polls %} {% comment %} {% validate request.user poll.groups as car%} + {% if car %} {% endcomment %}
-{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/gymkhanaModule/create_poll.html b/FusionIIIT/templates/gymkhanaModule/create_poll.html index f306940d7..7ff060178 100644 --- a/FusionIIIT/templates/gymkhanaModule/create_poll.html +++ b/FusionIIIT/templates/gymkhanaModule/create_poll.html @@ -29,8 +29,8 @@

Poll Information

- - + + From d77d812b5ea7e47753e53bfcbef80cc05b812c97 Mon Sep 17 00:00:00 2001 From: "Puliuvarthi.Mahesh" <134507390+MaheshPulivarthi18@users.noreply.github.com> Date: Sun, 18 Feb 2024 13:29:58 +0530 Subject: [PATCH 11/27] fixed: removed conflicts (#7) * use cases init * club approoval request to dean working * removed conflicts --- FusionIIIT/applications/gymkhana/views.py | 60 +++++++++++------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 25a3354d0..a9ca0edc7 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1042,19 +1042,20 @@ def change_head(request): And adds to the database. @param: - request - trivial + request - trivial @variables: - club - name of the club - co_ordinator - new co_ordinator of the club - co_coordinator - new co_cordinator of the club - date - date at which the heads of the clubs changes - time - time at which the heads changes - desc - description on change of heads - old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator - old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator - new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator - new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator + + club - name of the club + co_ordinator - new co_ordinator of the club + co_coordinator - new co_cordinator of the club + date - date at which the heads of the clubs changes + time - time at which the heads changes + desc - description on change of heads + old_co_ordinator - HoldsDesignation object and after deletes this co_ordinator + old_co_coordinator - HoldsDesignation object and after deletes this co_coordinator + new_co_ordinator - HoldsDesignation object and after saves this object as co_ordinator + new_co_coordinator - HoldsDesignation object and after saves this object as co_coordinator """ if request.method == "POST": @@ -1063,49 +1064,44 @@ def change_head(request): co_coordinator = request.POST.get('coco') date = request.POST.get("date") time = request.POST.get("time") - desc = f"co-ordinator and co co-ordinator changed on {date} at {time}" + desc = "co-ordinator and co co-ordinator changed on "+date+" at "+time message = "" + # club_name = get_object_or_404(Club_info, club_name=club) + co_ordinator_student = get_object_or_404(Student, id__user__username=co_ordinator) + co_coordinator_student = get_object_or_404(Student, id__user__username=co_coordinator) + club_info = get_object_or_404(Club_info, club_name=club) old_co_ordinator = club_info.co_ordinator old_co_coordinator = club_info.co_coordinator - club_info.co_ordinator = co_ordinator_student club_info.co_coordinator = co_coordinator_student club_info.save() message += "Successfully changed !!!" - - 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() - - 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() - HoldsDesignation.objects.filter(user__username=old_co_ordinator, designation__name="co-ordinator").delete() - HoldsDesignation.objects.filter(user__username=old_co_coordinator, designation__name="co co-ordinator").delete() + old_co_ordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_ordinator, designation__name="co-ordinator") + old_co_ordinator.delete() + old_co_coordinator = HoldsDesignation.objects.select_related('user','working','designation').filter(user__username=old_co_coordinator, designation__name="co co-ordinator") + old_co_coordinator.delete() content = { - 'status': "success", - 'message': message, - } + 'status':"success", + 'message':message, + } content = json.dumps(content) return HttpResponse(content) - # Handle non-POST requests or redirect if needed - # return redirect('/gymkhana/') + # return redirect('/gymkhana/') @login_required def new_session(request): From 2e3e4234f9a4fb22144305041f9f7311210284e4 Mon Sep 17 00:00:00 2001 From: RishabhSharma96 <114917946+RishabhSharma96@users.noreply.github.com> Date: Sun, 18 Feb 2024 14:31:48 +0530 Subject: [PATCH 12/27] date foreign key issue resolved --- FusionIIIT/applications/gymkhana/views.py | 6 +++--- FusionIIIT/templates/gymkhanaModule/change_head.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index a9ca0edc7..ddffa42f6 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1062,9 +1062,8 @@ def change_head(request): club = request.POST.get("club") co_ordinator = request.POST.get('co') co_coordinator = request.POST.get('coco') - date = request.POST.get("date") - time = request.POST.get("time") - desc = "co-ordinator and co co-ordinator changed on "+date+" at "+time + + desc = "co-ordinator and co co-ordinator changed on " + str(timezone.now()) message = "" # club_name = get_object_or_404(Club_info, club_name=club) @@ -1079,6 +1078,7 @@ def change_head(request): old_co_coordinator = club_info.co_coordinator club_info.co_ordinator = co_ordinator_student club_info.co_coordinator = co_coordinator_student + club_info.head_changed_on = timezone.now() club_info.save() message += "Successfully changed !!!" diff --git a/FusionIIIT/templates/gymkhanaModule/change_head.html b/FusionIIIT/templates/gymkhanaModule/change_head.html index c156eec15..1bf23f3cf 100644 --- a/FusionIIIT/templates/gymkhanaModule/change_head.html +++ b/FusionIIIT/templates/gymkhanaModule/change_head.html @@ -79,7 +79,7 @@
-
+
- {% elif request.user in poll.voters %} - - {% else %} - - {% endif %} -
-
-

- Created By: {{poll.created_by.0}}, {{poll.created_by.1}} -

+
+ {% for poll in voting_polls %} + {% validate request.user poll.groups as can_view %} + {% if can_view %} +
+ +
+

{{ poll.title }}

+ {% if poll.exp_date > now %} +

Expired

+ {% else %} +

Expires in: {{ poll.exp_date }} Days

+ {% endif %}
-
- +
+ +
+ {% csrf_token %} + {% if poll.exp_date > now %} +
+

Results

+

{{ poll.max }}

+
+ {% else %} + {% for choice in poll.choices %} +
+
{{ choice.title }}
+
+ +
+
+ {% endfor %} + {% endif %} +
+
+
+ {% if poll.exp_date == 'expire' %} + + {% elif roll in poll.voters %} + + {% else %} + + {% endif %} +
+
+

Created By: {{ poll.created_by.0 }}, {{ poll.created_by.1 }}

+
+
+
+
+
+ {% endif %} + {% endfor %}
- - {% comment %} {% endif %} {% endcomment %} {% endfor %} -
-{% endblock active_poll %} +{% endblock active_poll %} \ No newline at end of file From d0df8f6238316a6113fb1c412a64217c914f4d69 Mon Sep 17 00:00:00 2001 From: Shobhit Kushwaha Date: Sun, 18 Feb 2024 19:03:01 +0530 Subject: [PATCH 15/27] corrected: club budget sent to dean --- FusionIIIT/templates/gymkhanaModule/clubbudget.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/FusionIIIT/templates/gymkhanaModule/clubbudget.html b/FusionIIIT/templates/gymkhanaModule/clubbudget.html index 13b57f0bb..008818e9b 100644 --- a/FusionIIIT/templates/gymkhanaModule/clubbudget.html +++ b/FusionIIIT/templates/gymkhanaModule/clubbudget.html @@ -36,9 +36,7 @@
From 4340c77fb545586f3a3de2819ab4f8ce9e757363 Mon Sep 17 00:00:00 2001 From: Shobhit Kushwaha Date: Sun, 18 Feb 2024 19:04:40 +0530 Subject: [PATCH 16/27] corrected: club budget sent to dean --- requirements.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..ff10316eb --- /dev/null +++ b/requirements.txt @@ -0,0 +1,74 @@ +amqp==5.0.2 +arabic-reshaper==2.1.1 +asgiref==3.3.1 +attrs==20.3.0 +beautifulsoup4==4.9.3 +billiard==3.6.3.0 +Brotli==1.0.9 +bs4==0.0.1 +celery==5.0.5 +certifi==2020.12.5 +cffi==1.14.4 +chardet==4.0.0 +click==7.1.2 +click-didyoumean==0.0.3 +click-plugins==1.1.1 +click-repl==0.1.6 +cryptography==3.3.1 +defusedxml==0.6.0 +Django==3.1.5 +django-allauth==0.44.0 +django-cleanup==5.1.0 +django-cors-headers==3.7.0 +django-debug-toolbar==3.2 +django-extensions==3.1.1 +django-filter==2.4.0 +django-markdown-deux==1.0.5 +django-model-utils==4.1.1 +django-notifications-hq==1.6.0 +django-pagedown==2.2.0 +djangorestframework==3.12.2 +django-semanticui-forms==1.6.5 +django-unused-media==0.2.2 +future==0.18.2 +# gunicorn +html-text==0.5.2 +html5lib==1.1 +idna==2.10 +ipython==7.20.0 +ipython-genutils==0.2.0 +jsonfield==3.1.0 +jsonschema==3.2.0 +kombu==5.0.2 +lxml==4.6.2 +markdown2==2.3.10 +numpy==1.19.5 +oauthlib==3.1.0 +openpyxl==3.0.7 +Pillow==8.1.0 +prompt-toolkit==3.0.10 +psycopg2-binary==2.8.6 +pycparser==2.20 +PyJWT==2.0.1 +PyPDF2==1.26.0 +pyrsistent==0.17.3 +python-bidi==0.4.2 +python-dateutil==2.8.1 +python3-openid==3.2.0 +pytz==2020.5 +reportlab==3.5.59 +requests==2.25.1 +requests-oauthlib==1.3.0 +six==1.15.0 +soupsieve==2.1 +sqlparse==0.4.1 +swapper==1.1.2.post1 +urllib3==1.26.2 +vine==5.0.0 +wcwidth==0.2.5 +webencodings==0.5.1 +whitenoise==5.2.0 +xhtml2pdf==0.2.5 +xlrd==2.0.1 +XlsxWriter==1.3.7 +xlwt==1.3.0 \ No newline at end of file From 96ccd179144a4c3feb9c0d32679df144b8049257 Mon Sep 17 00:00:00 2001 From: Shobhit Kushwaha <109756367+shokushwaha@users.noreply.github.com> Date: Sun, 18 Feb 2024 19:05:08 +0530 Subject: [PATCH 17/27] Delete requirements1.txt --- requirements1.txt | 74 ----------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 requirements1.txt diff --git a/requirements1.txt b/requirements1.txt deleted file mode 100644 index afa44e4ac..000000000 --- a/requirements1.txt +++ /dev/null @@ -1,74 +0,0 @@ -amqp==5.0.2 -arabic-reshaper==2.1.1 -asgiref==3.3.1 -attrs==20.3.0 -beautifulsoup4==4.9.3 -billiard==3.6.3.0 -Brotli==1.0.9 -bs4==0.0.1 -celery==5.0.5 -certifi==2020.12.5 -cffi==1.14.4 -chardet==4.0.0 -click==7.1.2 -click-didyoumean==0.0.3 -click-plugins==1.1.1 -click-repl==0.1.6 -# cryptography==3.3.1 -defusedxml==0.6.0 -Django==3.1.5 -django-allauth==0.44.0 -django-cleanup==5.1.0 -django-cors-headers==3.7.0 -django-debug-toolbar==3.2 -django-extensions==3.1.1 -django-filter==2.4.0 -django-markdown-deux==1.0.5 -django-model-utils==4.1.1 -django-notifications-hq==1.6.0 -django-pagedown==2.2.0 -djangorestframework==3.12.2 -django-semanticui-forms==1.6.5 -django-unused-media==0.2.2 -future==0.18.2 -# gunicorn -html-text==0.5.2 -html5lib==1.1 -idna==2.10 -ipython==7.20.0 -ipython-genutils==0.2.0 -jsonfield==3.1.0 -jsonschema==3.2.0 -kombu==5.0.2 -lxml==4.6.2 -markdown2==2.3.10 -numpy==1.19.5 -oauthlib==3.1.0 -openpyxl==3.0.7 -Pillow==8.1.0 -prompt-toolkit==3.0.10 -psycopg2-binary==2.8.6 -pycparser==2.20 -PyJWT==2.0.1 -PyPDF2==1.26.0 -pyrsistent==0.17.3 -python-bidi==0.4.2 -python-dateutil==2.8.1 -python3-openid==3.2.0 -pytz==2020.5 -reportlab==3.5.59 -requests==2.25.1 -requests-oauthlib==1.3.0 -six==1.15.0 -soupsieve==2.1 -sqlparse==0.4.1 -swapper==1.1.2.post1 -urllib3==1.26.2 -vine==5.0.0 -wcwidth==0.2.5 -webencodings==0.5.1 -whitenoise==5.2.0 -xhtml2pdf==0.2.5 -xlrd==2.0.1 -XlsxWriter==1.3.7 -xlwt==1.3.0 \ No newline at end of file From b2804fb16ced427d1e7f89f981f5fc1f22472886 Mon Sep 17 00:00:00 2001 From: Rohit Raj Date: Sun, 18 Feb 2024 19:05:19 +0530 Subject: [PATCH 18/27] fix: packages file edited --- requirements1.txt => requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename requirements1.txt => requirements.txt (98%) diff --git a/requirements1.txt b/requirements.txt similarity index 98% rename from requirements1.txt rename to requirements.txt index afa44e4ac..ff10316eb 100644 --- a/requirements1.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ click==7.1.2 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 -# cryptography==3.3.1 +cryptography==3.3.1 defusedxml==0.6.0 Django==3.1.5 django-allauth==0.44.0 From ae3a3b781ce181aa06f7735d07143cf72c9defb2 Mon Sep 17 00:00:00 2001 From: Shobhit Kushwaha Date: Tue, 20 Feb 2024 13:32:09 +0530 Subject: [PATCH 19/27] view club budget added --- .../templates/gymkhanaModule/clubbudget.html | 64 ++++++++++++++++++- .../templates/gymkhanaModule/gymkhana.html | 8 +-- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/FusionIIIT/templates/gymkhanaModule/clubbudget.html b/FusionIIIT/templates/gymkhanaModule/clubbudget.html index 008818e9b..df06f8e84 100644 --- a/FusionIIIT/templates/gymkhanaModule/clubbudget.html +++ b/FusionIIIT/templates/gymkhanaModule/clubbudget.html @@ -4,7 +4,11 @@ + +
+
+
+
+ + +
+
+
+ +

Budget Information

+ + + + + + + + + + {% for budget in club_budgets %} + {% if budget.club.club_name == selected_club %} + + + + + + + {% endif %} + {% endfor %} + +
Budget ForBudget AmountDescriptionFile
+
+
+
+
+ + {% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/gymkhana.html b/FusionIIIT/templates/gymkhanaModule/gymkhana.html index 141ac70b9..e021a1944 100644 --- a/FusionIIIT/templates/gymkhanaModule/gymkhana.html +++ b/FusionIIIT/templates/gymkhanaModule/gymkhana.html @@ -364,14 +364,14 @@ - + - + - + Submit Event report To Convener From 8dab59d6ed5943a3d03c860b28e06af993eef822 Mon Sep 17 00:00:00 2001 From: RishabhSharma96 <114917946+RishabhSharma96@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:51:24 +0530 Subject: [PATCH 20/27] updated migrations error --- .../migrations/0002_auto_20240219_1607.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 FusionIIIT/applications/globals/migrations/0002_auto_20240219_1607.py diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20240219_1607.py b/FusionIIIT/applications/globals/migrations/0002_auto_20240219_1607.py new file mode 100644 index 000000000..e73d691bc --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0002_auto_20240219_1607.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-19 16:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] From 0c34cff077f6adca059fb257c5fe22afc1212228 Mon Sep 17 00:00:00 2001 From: RohanParmar2002 Date: Tue, 20 Feb 2024 15:56:53 +0530 Subject: [PATCH 21/27] segregated use cases based on actors --- .../migrations/0003_auto_20240220_1447.py | 18 + .../gymkhanaModule/club_details.html | 637 ++++----- .../templates/gymkhanaModule/clubbudget.html | 20 +- .../templates/gymkhanaModule/gymkhana.html | 1154 +++++++++-------- .../gymkhanaModule/voting_polls.html | 4 +- 5 files changed, 940 insertions(+), 893 deletions(-) create mode 100644 FusionIIIT/applications/globals/migrations/0003_auto_20240220_1447.py diff --git a/FusionIIIT/applications/globals/migrations/0003_auto_20240220_1447.py b/FusionIIIT/applications/globals/migrations/0003_auto_20240220_1447.py new file mode 100644 index 000000000..7156c124d --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0003_auto_20240220_1447.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2024-02-20 14:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0002_auto_20240219_1607'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/templates/gymkhanaModule/club_details.html b/FusionIIIT/templates/gymkhanaModule/club_details.html index 8dfd6391d..4ac5fb78c 100644 --- a/FusionIIIT/templates/gymkhanaModule/club_details.html +++ b/FusionIIIT/templates/gymkhanaModule/club_details.html @@ -1,39 +1,42 @@ {% load static %} {% block view_budget %} - {% comment %}The tab menu starts here!{% endcomment %} - +{% comment %}The tab menu starts here!{% endcomment %} + - {% for i in Club_name %} -