File tree 3 files changed +66
-2
lines changed
3 files changed +66
-2
lines changed Original file line number Diff line number Diff line change 1
- from flask import redirect
1
+ from flask import redirect , render_template , request
2
2
3
- from packet import auth , app
3
+ from packet import auth , app , db
4
+ from packet .models import Packet
4
5
from packet .utils import before_request
5
6
6
7
9
10
@before_request
10
11
def index (info = None ):
11
12
return redirect ("/packet/" + info ['uid' ], 302 )
13
+
14
+
15
+ @app .route ("/essays" )
16
+ @auth .oidc_auth
17
+ @before_request
18
+ def essays (info = None ):
19
+ packet = Packet .query .filter_by (freshman_username = info ['uid' ]).first ()
20
+ return render_template ("essays.html" , info = info , packet = packet )
21
+
22
+
23
+ @app .route ("/essay" , methods = ["POST" ])
24
+ @auth .oidc_auth
25
+ @before_request
26
+ def submit_essay (info = None ):
27
+ formdata = request .form
28
+ packet = Packet .query .filter_by (freshman_username = info ['uid' ]).first ()
29
+
30
+ packet .info_eboard = formdata ['info_eboard' ]
31
+ packet .info_events = formdata ['info_events' ]
32
+ packet .info_achieve = formdata ['info_achieve' ]
33
+ db .session .commit ()
34
+
35
+ return redirect ("/essays" , 302 )
Original file line number Diff line number Diff line change
1
+ {% extends "extend/base.html" %}
2
+
3
+ {% block body %}
4
+ < div class ="container main ">
5
+ < div class ="row mobile-hide ">
6
+ < div class ="col-sm-10 ">
7
+ < h3 class ="page-title "> Essays</ h3 >
8
+ </ div >
9
+ </ div >
10
+ < div id ="eval-blocks ">
11
+ < div id ="eval-table ">
12
+ < div class ="card ">
13
+ < div class ="card-body table-fill ">
14
+ < form action ="/essay " method ="post ">
15
+ < div class ="form-group ">
16
+ < label for ="info_eboard "> EBoard Members</ label >
17
+ < textarea class ="form-control " name ="info_eboard "> {{ packet.info_eboard }}</ textarea >
18
+ </ div >
19
+ < div class ="form-group ">
20
+ < label for ="info_events "> CSH Events</ label >
21
+ < textarea class ="form-control " name ="info_events "> {{ packet.info_events }}</ textarea >
22
+ </ div >
23
+ < div class ="form-group ">
24
+ < label for ="info_achieve "> Technical Achievements</ label >
25
+ < textarea class ="form-control " name ="info_achieve "> {{ packet.info_achieve }}</ textarea >
26
+ </ div >
27
+ < input type ="submit " value ="Submit " class ="btn btn-primary ">
28
+ </ form >
29
+ </ div >
30
+ </ div >
31
+ </ div >
32
+ </ div >
33
+ </ div >
34
+ {% endblock %}
Original file line number Diff line number Diff line change 14
14
< a class ="nav-link " href ="/packets "> Active Packets</ a >
15
15
</ li >
16
16
17
+ {% if info.realm != "csh" %}
18
+ < li class ="nav-item ">
19
+ < a class ="nav-link " href ="/essays "> Essays</ a >
20
+ </ li >
21
+ {% endif %}
22
+
17
23
</ ul >
18
24
< ul class ="nav navbar-nav ml-auto ">
19
25
< li class ="navbar-user dropdown ">
You can’t perform that action at this time.
0 commit comments