Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Agile Web Development (CITS3403).
RSS cloud
Jump to:


3 of 419 articles shown, currently no other people reading this forum.
From: Kai B.
Date: Mon 18th May 2020, 1:11pm


Hey guys,
I'm really struggling to use flask_admin at the moment. I am trying to set up a 
dashboard that displays some kind of "job board" where an admin can click on one 
item to submit a response to user (where the user has submitted an answer to a 
question). I've looked through the documentation a few times but I just can't wrap 
my head around anything. I'd like the dashboard to just appear on the basic /admin 
route, but I also dont know how to allow this route to take multiple (or even one) 
of the database models

I have flask_admin set up at the moment to just do the usual CRUD operations on the 
database using admin.add_view(...), but editing quizzes through here obviously 
doesn't look great and has too many options for simply responding to an answer.

I'm pretty sure what I need to know is how to properly use @ex*o*e() within 
different views, but I can't seem to do what I want so I may need more info.

Thanks for any help



From: Aiden L.
Date: Fri 22nd May 2020, 2:25pm


Hi all, 

I'm currently trying to initialise and add views to my flask admin. I'm struggling with 
where to put the admin.add_view(modelview...).

I have the following code in my __init__.py;

app.config['FLASK_ADMIN_SWATCH'] = 'cerulean'
admin = Admin(app, name='GameFinder', template_mode='bootstrap3')

and cant figure out where to put;

admin.add_view(ModelView(User, db.session))
admin.add_view(ModelView(Post, db.session))

All the tutorials I can find online have their applications made from one file, so 
separating these while keeping the User and Post classes accessible and the admin object is 
proving difficult.

Any help or pointers in the right direction would be appreciated.


From: Aiden L.
Date: Fri 22nd May 2020, 4:03pm


If anyone is struggling to do the same, I solved this by importing the already made classes at the 
bottom of __init__.py;


##initialisation code above##

from flask_admin.contrib.sqla import ModelView
from app.models import User, Post

admin.add_view(ModelView(User, db.session))
admin.add_view(ModelView(Post, db.session)) 
This Page

Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020