Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ package-lock.json

.DS_Store
**/generated.pdf
FusionIIIT/applications/iwdModuleV2/tests/reports/*.csv
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ENV PYTHONUNBUFFERED 1
COPY requirements.txt $FUSION_HOME

# install dependencies
RUN pip install --upgrade pip && pip install -r requirements.txt
RUN python -m pip install pip==21.1.1 && \
pip install -r requirements.txt

# copy api directory to docker's work directory.
COPY . $FUSION_HOME
Expand Down
41 changes: 24 additions & 17 deletions FusionIIIT/Fusion/middleware/custom_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,41 @@ def user_logged_in_handler(sender, user, request, **kwargs):
design = HoldsDesignation.objects.select_related('user','designation').filter(working=request.user)

designation=[]
if str(user.extrainfo.user_type) == "student":
designation.append(str(user.extrainfo.user_type))
# Safely access extrainfo - it may not exist for all users
user_type = getattr(user.extrainfo, 'user_type', None) if hasattr(user, 'extrainfo') else None

if user_type and str(user_type) == "student":
designation.append(str(user_type))


for i in design:
if str(i.designation) != str(user.extrainfo.user_type):
if user_type and str(i.designation) != str(user_type):
print('-------')
print(i.designation)
print(user.extrainfo.user_type)
print(user_type)
print('')
designation.append(str(i.designation))

for i in designation:
print(i)

request.session['currentDesignationSelected'] = designation[0]
request.session['allDesignations'] = designation
first_designation = designation[0]
module_access = ModuleAccess.objects.filter(designation=first_designation).first()

if module_access:
access_rights = {}

field_names = [field.name for field in ModuleAccess._meta.get_fields() if field.name not in ['id', 'designation']]

for field_name in field_names:
access_rights[field_name] = getattr(module_access, field_name)

access_rights = {}

if designation:
request.session['currentDesignationSelected'] = designation[0]
request.session['allDesignations'] = designation
first_designation = designation[0]
module_access = ModuleAccess.objects.filter(designation=first_designation).first()

if module_access:
field_names = [field.name for field in ModuleAccess._meta.get_fields() if field.name not in ['id', 'designation']]
for field_name in field_names:
access_rights[field_name] = getattr(module_access, field_name)
else:
# User has no designations, set defaults
request.session['currentDesignationSelected'] = None
request.session['allDesignations'] = []

request.session['moduleAccessRights'] = access_rights
print("logged iN")

Expand Down
8 changes: 7 additions & 1 deletion FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,10 @@
# session settings
SESSION_COOKIE_AGE = 15 * 60
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
SESSION_SAVE_EVERY_REQUEST = True

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2026-04-19 18:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('academic_information', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='student',
name='specialization',
field=models.CharField(choices=[('Power and Control', 'Power and Control'), ('Power & Control', 'Power & Control'), ('Microwave and Communication Engineering', 'Microwave and Communication Engineering'), ('Communication and Signal Processing', 'Communication and Signal Processing'), ('Micro-nano Electronics', 'Micro-nano Electronics'), ('Nanoelectronics and VLSI Design', 'Nanoelectronics and VLSI Design'), ('CAD/CAM', 'CAD/CAM'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('Manufacturing and Automation', 'Manufacturing and Automation'), ('CSE', 'CSE'), ('AI & ML', 'AI & ML'), ('Data Science', 'Data Science'), ('Mechatronics', 'Mechatronics'), ('MDes', 'MDes'), ('None', 'None'), ('', 'No Specialization')], default='', max_length=40, null=True),
),
]
53 changes: 53 additions & 0 deletions FusionIIIT/applications/eis/migrations/0003_auto_20260419_1852.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 3.1.5 on 2026-04-19 18:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('eis', '0002_auto_20250201_2228'),
]

operations = [
migrations.AlterField(
model_name='emp_achievement',
name='a_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_confrence_organised',
name='k_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_expert_lectures',
name='l_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_keynote_address',
name='k_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_mtechphd_thesis',
name='s_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_patents',
name='p_year',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_published_books',
name='pyear',
field=models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], null=True, verbose_name='year'),
),
migrations.AlterField(
model_name='emp_research_papers',
name='year',
field=models.CharField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024), (2025, 2025), (2026, 2026)], max_length=10, null=True),
),
]
11 changes: 7 additions & 4 deletions FusionIIIT/applications/globals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,13 @@ def dashboard(request):
}
# a=HoldsDesignation.objects.select_related('user','working','designation').filter(designation = user)
print(context)
print(type(user.extrainfo.user_type))
user_type = getattr(user.extrainfo, 'user_type', None) if hasattr(user, 'extrainfo') else None
print(type(user_type))
if(request.user.get_username() == 'director'):
return render(request, "dashboard/director_dashboard2.html", {})
elif( "dean_rspc" in designation):
return render(request, "dashboard/dashboard.html", context)
elif user.extrainfo.user_type != "student":
elif user_type and user_type != "student":
print ("inside")
designat = HoldsDesignation.objects.select_related().filter(user=user)
response = {'designat':designat}
Expand Down Expand Up @@ -835,10 +836,12 @@ def profile(request, username=None):
print("editable",editable)
profile = get_object_or_404(ExtraInfo, Q(user=user))
print("profile",profile)
if(str(user.extrainfo.user_type)=='faculty'):
user_type = getattr(user.extrainfo, 'user_type', None) if hasattr(user, 'extrainfo') else None
user_department = getattr(user.extrainfo, 'department', None) if hasattr(user, 'extrainfo') else None
if(user_type == 'faculty'):
print("profile")
return HttpResponseRedirect('/eis/profile/' + (username if username else ''))
if(str(user.extrainfo.department)=='department: Academics'):
if(user_department == 'department: Academics'):
print("profile2")
return HttpResponseRedirect('/aims')

Expand Down
Loading