This app shows the basic usage of Flask framework. It allows creation and deletion of users.
A user can self register but will require an approval from administrator before the user can have access to database entries.
This app shows the basic usage of Flask framework. It allows creation and deletion of users. A user can self register but will require an approval from administrator before the user can have access to database entries.
Once the user has access, (s)he can create a post and enter expenses.
It demonstrates the usage of jinja2 macros
, jinja2 templates
that are reusable.
There is one template called tabular_view.html
which can generate the table based on values passed as explained below.
It also uses three partial templates addModalNew.html
, deleteModalNew.html
and updateModalNew.html
which in turn use the values passed to the parent template.
The python code that renders the tabular_view.html
can be seen in the functions expenses
in approot/expense/routes.py
and registeredusers
in approot/users/routes.py
Detailed explanation here
04/10/2019
- Added dark and light mode switch.
- Added the ability for user to change available themes
- Change Account Page to have groupings for settings and user info.
- Added "Clone" functionality.
01/10/2019
- Updated Macro to make it work better for SelectField (populate the selected option on update form), DecimalField (add number fieldtype and step)
- Created tabular_view.html which can be used for displaying table for any query data. All data to be displayed and columns can just be passed from routes.py.
- Complete rewrite of expenses and users routes to make them work with single template - Ensuring DRY principle.
- Added "Save and Continue" functionality on the "AddModal"
22/09/2019
- Bootstrap Table related - Removed Server side pagination
- Moved User Expense from User blue print to Expense Blue Print
- Changed landing page to about.html and made home page accessible to logged in users.
- Created a dark theme and applied as default.
-
Create Macro for creating fields- Done -
Create a grid editable form- Added following functionality on expenses page:Ability to make a row editable using edit button.- Done (For Expense Page)Ability to update using Modal Form.- Done (For User Page)Add "search" box. - Basic Search on expenses table is added but can be improved.Done - Applied Bootstrap Table- Add "select" row and "multiple delete" - Explore "bootstrap table" as an option.
-
Modals
Creation and submission of forms using Modals.- DoneValidation to display in Modals and not take back to the page form.- DoneMake the update button disappear for entries created by other users.DoneMake modal changes for Users tableDone- Make modal changes for Posts Table.
- Clean Up code
-
Creation of subforms - Possibly just a mechanism to add modals.
Although need to understand the cascade of deletion using SQLAlchemy.CASCADE Deletion now works. Just needed to ensure the models definition includedcascade='all,delete,delete-orphan'
in the relationship definition.
A working demo is available on the link: https://flask-admin-skeleton.herokuapp.com
or deploy your own:
- Clone this repository on your desktop in the python virtual environment.
- Run following commands to install dependencies:
pip install --upgrade pip
pip install gunicorn flask run.py flask-bootstrap flask-mail flask-SQLAlchemy flask-bcrypt flask-table flask-wtf flask-login pillow
- Go to the directory
approot
on terminal / commandline and type the commandpython run.py
- Although step 2 should have taken care of all dependencies, install any missing dependencies depending on any error during the startup.
- Once the run.py has worked, press
Ctrl+C
to stop the server. - Then type python and in the python interpreter initiate database using the
create_admin_user.py
- Now start the app by typing
python run.py
- In your browser type: http://localhost:5000/ and register a user with your own username and password.
- Login using the username
admin@admin.com
and passwordadminpassword
- Go to "Registered Users" link and update the user role to
Admin
. - Logout and login with user you created in Step 7.
- Go to Registered users and delete the default admin user you created.
- Explore further!!!