Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ac 7 Updated code With changed database #1523

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
9 changes: 4 additions & 5 deletions FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.humanize',
'django_crontab',

'corsheaders',

'applications.eis',
@@ -172,7 +172,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '..', 'templates'),],
'DIRS': [os.path.join(BASE_DIR, '..', 'templates/'),],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -257,9 +257,9 @@

# os.path.join(BASE_DIR, 'static/')
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '..', 'static')
STATIC_ROOT = os.path.join(BASE_DIR, '..', 'static/')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')
MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media/')
MEDIA_URL = '/media/'

ACCOUNT_USERNAME_REQUIRED = False
@@ -280,6 +280,5 @@
YOUTUBE_DATA_API_KEY = 'api_key'



CORS_ORIGIN_ALLOW_ALL = True
ALLOW_PASS_RESET = True
12 changes: 1 addition & 11 deletions FusionIIIT/Fusion/settings/development.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from Fusion.settings.common import *

DEBUG = True
TEMPLATE_DEBUG = True

SECRET_KEY = '=&w9due426k@l^ju1=s1)fj1rnpf0ok8xvjwx+62_nc-f12-8('

ALLOWED_HOSTS = ['*']
@@ -16,11 +16,9 @@
}
}


REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
@@ -55,11 +53,3 @@
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
}

CRONJOBS = [
# the below job will update the bill at every minute can be used for testing
# ('* * * * *', 'applications.central_mess.tasks.generate_bill'),

#the below job which we need to add in production server, to update the mess bill of student everyday at 10 pm in night
('0 22 * * *', 'applications.central_mess.tasks.generate_bill'),
]
1 change: 1 addition & 0 deletions FusionIIIT/applications/academic_information/admin.py
Original file line number Diff line number Diff line change
@@ -32,3 +32,4 @@ class Curriculum_InstructorAdmin(admin.ModelAdmin):
admin.site.register(Holiday)
admin.site.register(Curriculum,CurriculumAdmin)

#Hello!
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ class Meta:

class CurriculumSerializer(serializers.ModelSerializer):
course_id = CourseSerializer()

class Meta:
model = Curriculum
fields = ('curriculum_id','course_code','course_id','credits','course_type',
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.1.5 on 2024-04-15 23:58
# Generated by Django 3.1.5 on 2023-03-15 18:53

from django.db import migrations, models
import django.db.models.deletion
@@ -9,8 +9,8 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('globals', '0001_initial'),
('programme_curriculum', '0001_initial'),
('globals', '0001_initial'),
]

operations = [
@@ -117,8 +117,8 @@ class Migration(migrations.Migration):
('batch', models.IntegerField(default=2016)),
('cpi', models.FloatField(default=0)),
('category', models.CharField(choices=[('GEN', 'General'), ('SC', 'Scheduled Castes'), ('ST', 'Scheduled Tribes'), ('OBC', 'Other Backward Classes')], max_length=10)),
('father_name', models.CharField(default='', max_length=40, null=True)),
('mother_name', models.CharField(default='', max_length=40, null=True)),
('father_name', models.CharField(default='', max_length=40)),
('mother_name', models.CharField(default='', max_length=40)),
('hall_no', models.IntegerField(default=0)),
('room_no', models.CharField(blank=True, max_length=10, null=True)),
('specialization', models.CharField(choices=[('Power and Control', 'Power and Control'), ('Microwave and Communication Engineering', 'Microwave and Communication Engineering'), ('Micro-nano Electronics', 'Micro-nano Electronics'), ('CAD/CAM', 'CAD/CAM'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('CSE', 'CSE'), ('Mechatronics', 'Mechatronics'), ('MDes', 'MDes'), ('None', 'None')], default='', max_length=40, null=True)),
26 changes: 3 additions & 23 deletions FusionIIIT/applications/academic_information/models.py
Original file line number Diff line number Diff line change
@@ -66,35 +66,15 @@ class Constants:


class Student(models.Model):
'''
Current Purpose : To store information pertinent to a user who is also a student



ATTRIBUTES :

id(globals.ExtraInfo) - one to one unique reference to the nominal details of the student[not nullable]
program(char) - to store the programme (eg: Btech Mtech)
batch(Integer) - to store the batch year(eg 2019)
batch_id(programme_curriculum.Batch) - reference to the Batch collective details(foreign key, can be null)
cpi(Float) - to store the current CPI of the student
category - to store the details about category of a sutdent (General/OBC etc)[not nullable]
father_name(char) - father's name
mother_name(char) - mother's name
hall_no(integer) - the hostel number in which the student has been alloted a room
room_no(char) - the room.no of the student
specialization - to dentote the specialization for MTECH students[null is allowed]
cur_sem_no(integer) - the current semester of the student

'''

id = models.OneToOneField(ExtraInfo, on_delete=models.CASCADE, primary_key=True)
programme = models.CharField(max_length=10, choices=Constants.PROGRAMME)
batch = models.IntegerField(default=2016)
batch_id = models.ForeignKey(Batch, null=True, blank=True, on_delete=models.CASCADE)
cpi = models.FloatField(default=0)
category = models.CharField(max_length=10, choices=Constants.CATEGORY, null=False)
father_name = models.CharField(max_length=40, default='',null=True)
mother_name = models.CharField(max_length=40, default='',null=True)
father_name = models.CharField(max_length=40, default='')
mother_name = models.CharField(max_length=40, default='')
hall_no = models.IntegerField(default=0)
room_no = models.CharField(max_length=10, blank=True, null=True)
specialization = models.CharField(max_length=40,choices=Constants.MTechSpecialization, null=True, default='')
62 changes: 22 additions & 40 deletions FusionIIIT/applications/academic_information/views.py
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@



from applications.academic_procedures.views import acad_proced_global_context , get_sem_courses
from applications.academic_procedures.views import acad_proced_global_context
from applications.programme_curriculum.models import Batch


@@ -107,8 +107,9 @@ def get_context(request):
# course_type = Constants.COURSE_TYPE
# timetable = Timetable.objects.all()
# exam_t = Exam_timetable.objects.all()

procedures_context = acad_proced_global_context()
notifs = request.user.notifications.all()

try:
examTtForm = ExamTimetableForm()
acadTtForm = AcademicTimetableForm()
@@ -175,8 +176,7 @@ def get_context(request):
'batch_branch_data' : procedures_context['batch_branch_data'],
'assistant_flag' : assistant_flag,
'hod_flag' : hod_flag,
'account_flag' : account_flag,
'notifications': notifs,
'account_flag' : account_flag
}

return context
@@ -842,16 +842,12 @@ def generatexlsheet(request):
"""
if user_check(request):
return HttpResponseRedirect('/academic-procedures/')
# print(request.POST)

try:
batch = request.POST['batch']#batch hai year wala (2020 , 21)
course_id = int(request.POST['course']) # id of course in integer
course = course = Courses.objects.get(id=course_id)

# print(course.name)
batch = request.POST['batch']
course = Courses.objects.get(id = request.POST['course'])
obj = course_registration.objects.all().filter(course_id = course)
except Exception as e:
print(str(e))
batch=""
course=""
curr_key=""
@@ -1033,14 +1029,9 @@ def generate_preregistration_report(request):
max_width = max(max_width,len(choices_of_current_student))

for choice in range(1,len(choices_of_current_student)+1):
try:
current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem, course_slot_id=slot, priority=choice)
z.append(str(current_choice.course_id.code) + "-" + str(current_choice.course_id.name))
except :
z.append("No registration found")
# current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem,course_slot_id = slot,priority = choice)
# # #print("current choice is ",current_choice)
# z.append(str(current_choice.course_id.code)+"-"+str(current_choice.course_id.name))
current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem,course_slot_id = slot,priority = choice)
# #print("current choice is ",current_choice)
z.append(str(current_choice.course_id.code)+"-"+str(current_choice.course_id.name))

data.append(z)
m+=1
@@ -1178,9 +1169,9 @@ def add_new_profile (request):
}
if request.method == 'POST' and request.FILES:
profiles=request.FILES['profiles']
excel = xlrd.open_workbook(profiles.name,file_contents=profiles.read())
excel = xlrd.open_workbook(file_contents=profiles.read())
sheet=excel.sheet_by_index(0)
for i in range(1,sheet.nrows):
for i in range(sheet.nrows):
roll_no=sheet.cell(i,0).value
first_name=str(sheet.cell(i,1).value)
last_name=str(sheet.cell(i,2).value)
@@ -1200,7 +1191,7 @@ def add_new_profile (request):
category=""
phone_no=0
address=""
dept=str(sheet.cell(i,11).value)
dept=str(sheet.cell(i,12).value)
specialization=str(sheet.cell(i,12).value)
hall_no=None

@@ -1218,14 +1209,14 @@ def add_new_profile (request):
batch_year=request.POST['Batch']

batch = Batch.objects.all().filter(name = programme_name, discipline__acronym = dept, year = batch_year).first()

user = User.objects.create_user(
username=roll_no,
password='hello123',
first_name=first_name,
last_name=last_name,
email=email,
)


einfo = ExtraInfo.objects.create(
id=roll_no,
@@ -1262,11 +1253,6 @@ def add_new_profile (request):
working=user,
designation=desig,
)

user.save()
einfo.save()
stud_data.save()
hold_des.save()

sem_id = Semester.objects.get(curriculum = batch.curriculum, semester_no = sem)
course_slots = CourseSlot.objects.all().filter(semester = sem_id)
@@ -2077,15 +2063,14 @@ def view_all_student_data(request):
"specailization": student.specialization,
"gender" : student.id.sex,
"category": student.category,
# "pwd_status": student.pwd_status,
"pwd_status": False,
"pwd_status": student.pwd_status,
"Mobile": student.id.phone_no,
"dob" : student.id.date_of_birth,
"emailid" : student.id.user.email,
"father_name": student.father_name,
# "father_mobile_no": student.father_mobile_no,
"father_mobile_no": student.father_mobile_no,
"mother_name": student.mother_name,
# "mother_mobile_no": student.mother_mobile_no,
"mother_mobile_no": student.mother_mobile_no,
"address": student.id.address
}
data.append(obj)
@@ -2155,9 +2140,9 @@ def generatestudentxlsheet(request):
data = None
else:
if(request_rollno != ""):
students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
else:
students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
for i in students:
obj = []
obj.append(i.batch)
@@ -2168,17 +2153,14 @@ def generatestudentxlsheet(request):
obj.append(i.specialization)
obj.append(i.id.sex)
obj.append(i.category)
#obj.append(i.pwd_status)
obj.append(None)
obj.append(i.pwd_status)
obj.append(i.id.phone_no)
obj.append(i.id.date_of_birth)
obj.append(i.id.user.email)
obj.append(i.father_name)
#obj.append(i.father_mobile_no)
obj.append(None)
obj.append(i.father_mobile_no)
obj.append(i.mother_name)
# obj.append(i.mother_mobile_no)
obj.append(None)
obj.append(i.mother_mobile_no)
obj.append(i.id.address)
data.append(obj)
data.sort()
49 changes: 5 additions & 44 deletions FusionIIIT/applications/academic_procedures/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from rest_framework.authtoken.models import Token
from rest_framework import serializers

from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations,InitialRegistration,
FinalRegistration, FinalRegistrations, SemesterMarks,
BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , Course, course_registration)
from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations,
FinalRegistrations, SemesterMarks,
BranchChange)

from applications.academic_information.api.serializers import (CurriculumInstructorSerializer,
CurriculumSerializer , CourseSerializer , StudentSerializers )
from applications.globals.api.serializers import (UserSerializer, HoldsDesignationSerializer , ExtraInfoSerializer)
CurriculumSerializer)
from applications.globals.api.serializers import (UserSerializer, HoldsDesignationSerializer)

class ThesisTopicProcessSerializer(serializers.ModelSerializer):

@@ -27,24 +27,6 @@ class Meta:
model = FinalRegistrations
fields = ('__all__')

class InitialRegistrationSerializer(serializers.ModelSerializer):

class Meta:
model = InitialRegistration
fields = ('__all__')

class FinalRegistrationSerializer(serializers.ModelSerializer):

class Meta:
model = FinalRegistration
fields = ('__all__')

class StudentRegistrationChecksSerializer(serializers.ModelSerializer):
class Meta:
model = StudentRegistrationChecks
fields = '__all__'


class SemesterMarksSerializer(serializers.ModelSerializer):

class Meta:
@@ -56,24 +38,3 @@ class BranchChangeSerializer(serializers.ModelSerializer):
class Meta:
model = BranchChange
fields = ('__all__')

class SemesterSerializer(serializers.ModelSerializer):

class Meta:
model = Semester
fields = ('__all__')

class CourseRegistrationSerializer(serializers.ModelSerializer):
class Meta:
model = course_registration
fields = ('__all__')

class CourseSlotSerializer(serializers.ModelSerializer):
class Meta:
model = CourseSlot
fields = ('__all__')

class CourseSerializer(serializers.ModelSerializer):
class Meta:
model = Course
fields = ('__all__')
Loading