1
-
2
1
import os
3
2
from flask_admin import Admin
4
3
from .models import db , User , Notes , Habits , Goals , Projects
5
4
from flask_admin .contrib .sqla import ModelView
6
5
6
+ class UserView (ModelView ):
7
+ column_list = ('name' , 'email' ,'password' , 'gender' , 'is_active' , 'role' )
8
+ form_columns = ('name' , 'email' ,'password' , 'gender' , 'is_active' , 'role' )
9
+
7
10
class NotesView (ModelView ):
8
11
column_list = ('title' , 'description' ,'category' , 'user_id' , 'projects_id' )
9
12
form_columns = ('title' , 'description' ,'category' , 'user_id' , 'projects_id' )
10
13
11
14
class HabitsView (ModelView ):
12
- column_list = ('name' , 'description' ,'category' , 'user_id ' , 'goals_id ' , 'ready ' )
13
- form_columns = ('name' , 'description' ,'category' , 'user_id ' , 'goals_id' , 'ready ' )
15
+ column_list = ('name' , 'description' , 'category' , 'ready ' , 'user_id ' , 'goals_id ' )
16
+ form_columns = ('name' , 'description' , 'category' , 'ready ' , 'user_id' , 'goals_id ' )
14
17
15
18
class GoalsView (ModelView ):
16
- column_list = ('target' , 'description' , 'user_id ' , 'projects_id ' , 'ready ' )
17
- form_columns = ('target' , 'description' ,'user_id ' , 'projects_id ' , 'ready ' )
19
+ column_list = ('target' , 'description' , 'ready ' , 'user_id ' , 'projects_id ' )
20
+ form_columns = ('target' , 'description' , 'ready ' , 'user_id ' , 'projects_id ' )
18
21
19
22
class ProjectsView (ModelView ):
20
23
column_list = ('name' , 'description' , 'category' , 'user_id' )
@@ -28,7 +31,7 @@ def setup_admin(app):
28
31
29
32
30
33
# Add your models here, for example this is how we add a the User model to the admin
31
- admin .add_view (ModelView (User , db .session ))
34
+ admin .add_view (UserView (User , db .session ))
32
35
admin .add_view (NotesView (Notes , db .session ))
33
36
admin .add_view (HabitsView (Habits , db .session ))
34
37
admin .add_view (GoalsView (Goals , db .session ))
0 commit comments