Skip to content

Commit cc97ddf

Browse files
author
Narosen Longkumer
authored
Merge branch 'master' into master
2 parents 23be440 + e85cbbb commit cc97ddf

File tree

10 files changed

+378
-354
lines changed

10 files changed

+378
-354
lines changed

.vscode/launch.json

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python",
6+
"type": "python",
7+
"request": "launch",
8+
"stopOnEntry": true,
9+
"pythonPath": "${config:python.pythonPath}",
10+
"program": "${file}",
11+
"cwd": "${workspaceRoot}",
12+
"env": {},
13+
"envFile": "${workspaceRoot}/.env",
14+
"debugOptions": [
15+
"WaitOnAbnormalExit",
16+
"WaitOnNormalExit",
17+
"RedirectOutput"
18+
]
19+
},
20+
{
21+
"name": "PySpark",
22+
"type": "python",
23+
"request": "launch",
24+
"stopOnEntry": true,
25+
"osx": {
26+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
27+
},
28+
"windows": {
29+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"
30+
},
31+
"linux": {
32+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
33+
},
34+
"program": "${file}",
35+
"cwd": "${workspaceRoot}",
36+
"env": {},
37+
"envFile": "${workspaceRoot}/.env",
38+
"debugOptions": [
39+
"WaitOnAbnormalExit",
40+
"WaitOnNormalExit",
41+
"RedirectOutput"
42+
]
43+
},
44+
{
45+
"name": "Python Module",
46+
"type": "python",
47+
"request": "launch",
48+
"stopOnEntry": true,
49+
"pythonPath": "${config:python.pythonPath}",
50+
"module": "module.name",
51+
"cwd": "${workspaceRoot}",
52+
"env": {},
53+
"envFile": "${workspaceRoot}/.env",
54+
"debugOptions": [
55+
"WaitOnAbnormalExit",
56+
"WaitOnNormalExit",
57+
"RedirectOutput"
58+
]
59+
},
60+
{
61+
"name": "Integrated Terminal/Console",
62+
"type": "python",
63+
"request": "launch",
64+
"stopOnEntry": true,
65+
"pythonPath": "${config:python.pythonPath}",
66+
"program": "${file}",
67+
"cwd": "",
68+
"console": "integratedTerminal",
69+
"env": {},
70+
"envFile": "${workspaceRoot}/.env",
71+
"debugOptions": [
72+
"WaitOnAbnormalExit",
73+
"WaitOnNormalExit"
74+
]
75+
},
76+
{
77+
"name": "External Terminal/Console",
78+
"type": "python",
79+
"request": "launch",
80+
"stopOnEntry": true,
81+
"pythonPath": "${config:python.pythonPath}",
82+
"program": "${file}",
83+
"cwd": "",
84+
"console": "externalTerminal",
85+
"env": {},
86+
"envFile": "${workspaceRoot}/.env",
87+
"debugOptions": [
88+
"WaitOnAbnormalExit",
89+
"WaitOnNormalExit"
90+
]
91+
},
92+
{
93+
"name": "Django",
94+
"type": "python",
95+
"request": "launch",
96+
"stopOnEntry": true,
97+
"pythonPath": "${config:python.pythonPath}",
98+
"program": "${workspaceRoot}/manage.py",
99+
"cwd": "${workspaceRoot}",
100+
"args": [
101+
"runserver",
102+
"--noreload",
103+
"--nothreading"
104+
],
105+
"env": {},
106+
"envFile": "${workspaceRoot}/.env",
107+
"debugOptions": [
108+
"WaitOnAbnormalExit",
109+
"WaitOnNormalExit",
110+
"RedirectOutput",
111+
"DjangoDebugging"
112+
]
113+
},
114+
{
115+
"name": "Flask",
116+
"type": "python",
117+
"request": "launch",
118+
"stopOnEntry": false,
119+
"pythonPath": "${config:python.pythonPath}",
120+
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
121+
"cwd": "${workspaceRoot}",
122+
"env": {
123+
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
124+
},
125+
"args": [
126+
"run",
127+
"--no-debugger",
128+
"--no-reload"
129+
],
130+
"envFile": "${workspaceRoot}/.env",
131+
"debugOptions": [
132+
"WaitOnAbnormalExit",
133+
"WaitOnNormalExit",
134+
"RedirectOutput"
135+
]
136+
},
137+
{
138+
"name": "Flask (old)",
139+
"type": "python",
140+
"request": "launch",
141+
"stopOnEntry": false,
142+
"pythonPath": "${config:python.pythonPath}",
143+
"program": "${workspaceRoot}/run.py",
144+
"cwd": "${workspaceRoot}",
145+
"args": [],
146+
"env": {},
147+
"envFile": "${workspaceRoot}/.env",
148+
"debugOptions": [
149+
"WaitOnAbnormalExit",
150+
"WaitOnNormalExit",
151+
"RedirectOutput"
152+
]
153+
},
154+
{
155+
"name": "Pyramid",
156+
"type": "python",
157+
"request": "launch",
158+
"stopOnEntry": true,
159+
"pythonPath": "${config:python.pythonPath}",
160+
"cwd": "${workspaceRoot}",
161+
"env": {},
162+
"envFile": "${workspaceRoot}/.env",
163+
"args": [
164+
"${workspaceRoot}/development.ini"
165+
],
166+
"debugOptions": [
167+
"WaitOnAbnormalExit",
168+
"WaitOnNormalExit",
169+
"RedirectOutput",
170+
"Pyramid"
171+
]
172+
},
173+
{
174+
"name": "Watson",
175+
"type": "python",
176+
"request": "launch",
177+
"stopOnEntry": true,
178+
"pythonPath": "${config:python.pythonPath}",
179+
"program": "${workspaceRoot}/console.py",
180+
"cwd": "${workspaceRoot}",
181+
"args": [
182+
"dev",
183+
"runserver",
184+
"--noreload=True"
185+
],
186+
"env": {},
187+
"envFile": "${workspaceRoot}/.env",
188+
"debugOptions": [
189+
"WaitOnAbnormalExit",
190+
"WaitOnNormalExit",
191+
"RedirectOutput"
192+
]
193+
},
194+
{
195+
"name": "Attach (Remote Debug)",
196+
"type": "python",
197+
"request": "attach",
198+
"localRoot": "${workspaceRoot}",
199+
"remoteRoot": "${workspaceRoot}",
200+
"port": 3000,
201+
"secret": "my_secret",
202+
"host": "localhost"
203+
}
204+
]
205+
}

FusionIIIT/Fusion/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
'ENGINE': 'django.db.backends.mysql',
153153
'NAME': 'fusion',
154154
'USER': 'root',
155-
'PASSWORD': '',
155+
'PASSWORD': 'root',
156156
'HOST': '127.0.0.1',
157157
'PORT': '3306',
158158
},

FusionIIIT/Fusion/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
url(r'^logout/', auth_views.logout, name='logout'),
3939
url(r'^academic-procedures/', include('applications.academic_procedures.urls',
4040
namespace='procedures')),
41-
url(r'^academic-information-system/', include('applications.academic_information.urls')),
42-
41+
url(r'^aims/', include('applications.academic_information.urls')),
4342
]
43+
4444
if settings.DEBUG:
4545
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

FusionIIIT/applications/academic_information/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class Student(models.Model):
4646
mother_name = models.CharField(max_length=40, default='')
4747
hall_no = models.IntegerField(default=1)
4848
room_no = models.CharField(max_length=10, blank=True, null=True)
49-
category = models.CharField(max_length=10, choices=Constants.CATEGORY),
5049

5150
def __str__(self):
5251
return str(self.id)
@@ -67,12 +66,12 @@ def __str__(self):
6766

6867

6968
class Meeting(models.Model):
70-
venue = models.CharField(max_length=50)
7169
date = models.DateField()
7270
time = models.CharField(max_length=20)
7371
agenda = models.FileField()
7472
minutes_file = models.FileField(max_length=40)
7573

74+
7675
class Meta:
7776
db_table = 'Meeting'
7877

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Submit post on submit
2+
$(document).ready(function() {
3+
$('#senate-member').on('submit', function(event){
4+
create_member();
5+
});
6+
});
7+
8+
function create_member() {
9+
$.ajax({
10+
type : "POST", // http method
11+
url : "senate/", // the endpoint
12+
dataType: 'json',
13+
data : {
14+
'rollno' : $('#rollno').val()
15+
},
16+
// data sent with the post request
17+
// handle a successful response
18+
success : function(data) {
19+
alert("success");
20+
},
21+
error : function(data) {
22+
alert("fail");
23+
}
24+
});
25+
};
26+
27+
28+
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from django.conf.urls import url
2-
32
from . import views
43

4+
app_name = 'academic_information'
5+
56
urlpatterns = [
67
url(r'^$', views.homepage, name='homepage'),
8+
url(r'^senate/$', views.senate, name='senate'),
79
url(r'^input/$', views.test, name='input'),
810
url(r'^delete/$', views.delete, name='delete'),
9-
]
11+
]

FusionIIIT/applications/academic_information/views.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,52 @@
33
from django.shortcuts import render
44
from .models import Student
55
from applications.globals.models import ExtraInfo, Designation, DepartmentInfo
6-
from django.template.defaulttags import csrf_token
76
from django.http import HttpResponse
7+
from django.db.models.query import QuerySet
8+
from django.views.decorators.csrf import csrf_exempt
9+
from django.http import JsonResponse
10+
import json
811

912

1013
def homepage(request):
11-
12-
s = Designation.objects.get(name = 'senate')
1314
try:
15+
s = Designation.objects.get(name = 'senate')
1416
senates = ExtraInfo.objects.filter(designation = s)
17+
students = Student.objects.filter(id__in = senates)
18+
1519
except:
1620
senates = ""
21+
students = ""
1722
pass
1823

1924
context = {
2025
'senates':senates,
21-
}
22-
26+
'students':students,
27+
}
2328
return render(request, "ais/ais.html", context)
2429

25-
def test(request):
26-
s = Designation.objects.get(name = 'senate')
27-
if request.method == 'POST':
28-
extraInfo = ExtraInfo.objects.get(id = request.POST['Roll Number'])
29-
extraInfo.designation.add(s)
30-
extraInfo.save()
31-
return HttpResponse("Data Inputed")
32-
33-
3430
def delete(request):
3531
s = Designation.objects.get(name = "senate")
3632
student = ExtraInfo.objects.get(id = request.POST["delete"])
3733
student.designation.remove(s)
3834
return HttpResponse("Deleted")
3935

40-
36+
@csrf_exempt
37+
def senate(request):
38+
if request.method == 'POST':
39+
rollno = request.POST.get('rollno')
40+
s = Designation.objects.get(name = 'senate')
41+
extraInfo = ExtraInfo.objects.get(id = rollno)
42+
extraInfo.designation.add(s)
43+
extraInfo.save()
44+
student = Student.objects.get(id = extraInfo)
45+
data = {
46+
'name' : extraInfo.user.username,
47+
'rollno' : extraInfo.id,
48+
'programme' : student.programme,
49+
'branch' : extraInfo.department.name
50+
}
51+
return JsonResponse(data)
52+
else:
53+
data = {}
54+
return JsonResponse(data)

0 commit comments

Comments
 (0)