-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvivere.py
More file actions
36 lines (22 loc) · 939 Bytes
/
vivere.py
File metadata and controls
36 lines (22 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import flask_admin as admin
from flask_admin.contrib.mongoengine import ModelView
import flask_login as login
import os
from configuration import *
from werkzeug.contrib.fixers import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
from views import *
from admin_login_manager import *
admin = admin.Admin(app, 'MenloHacks Vivere', index_view=SecureAdminIndexView(), base_template='my_master.html')
from models import Announcement, Event, EventLocation, MentorTicket
class SecureModelView(ModelView):
def is_accessible(self):
return login.current_user.is_authenticated and login.current_user.is_admin
# Add views
admin.add_views(SecureModelView(Announcement))
admin.add_view(SecureModelView(Event))
admin.add_views(SecureModelView(EventLocation))
admin.add_views(SecureModelView(User))
admin.add_views(SecureModelView(MentorTicket))
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=80)