├── .gitignore ├── README.md ├── flaskstarter ├── __init__.py ├── app.py ├── config.py ├── decorators.py ├── emails │ └── __init__.py ├── extensions.py ├── frontend │ ├── __init__.py │ ├── forms.py │ ├── models.py │ └── views.py ├── settings │ ├── __init__.py │ ├── forms.py │ └── views.py ├── static │ ├── bootstrap.bundle.min.js │ ├── bootstrap.min.css │ └── jquery.slim.min.js ├── tasks │ ├── __init__.py │ ├── forms.py │ ├── models.py │ └── views.py ├── templates │ ├── admin │ │ └── index.html │ ├── dashboard │ │ └── dashboard.html │ ├── frontend │ │ ├── change_password.html │ │ ├── contact_us.html │ │ ├── landing.html │ │ ├── login.html │ │ ├── reset_password.html │ │ └── signup.html │ ├── layouts │ │ ├── base.html │ │ └── header.html │ ├── macros │ │ ├── _confirm_account.html │ │ ├── _flash_msg.html │ │ ├── _form.html │ │ └── _reset_password.html │ ├── settings │ │ ├── password.html │ │ └── profile.html │ └── tasks │ │ ├── add_task.html │ │ ├── edit_task.html │ │ ├── my_tasks.html │ │ └── view_task.html ├── user │ ├── __init__.py │ ├── constants.py │ └── models.py └── utils.py ├── manage.py ├── requirements.txt ├── screenshots ├── admin.png ├── dashboard.png ├── homepage.png ├── login.png ├── profile.png ├── signup.png └── tasks.png └── tests ├── __init__.py └── test_flaskstarter.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | *.py[cod] 3 | *$py.class 4 | .Python 5 | build/ 6 | develop-eggs/ 7 | dist/ 8 | eggs/ 9 | .eggs/ 10 | .pytest_cache/ 11 | instance/ 12 | .venv 13 | env/ 14 | venv/ 15 | ENV/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flask-Starter 2 | 3 | Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the ready-to-use bare minimum essentials. 4 | 5 | ## Features 6 | 7 | - Flask 2.0, Python (`PEP8`) 8 | - Signup, Login with (email, password) 9 | - Forget/reset passwords 10 | - Email verification 11 | - User profile/password updates 12 | - User roles (admin, user, staff) 13 | - User profile status (active, inactive) 14 | - Admin dashboard for management 15 | - Contact us form 16 | - Basic tasks/todo model (easily replace with your use-case) 17 | - Bootstrap template (minimal) 18 | - Utility scripts (initiate dummy database, run test server) 19 | - Test & Production Configs 20 | - Tests [To Do] 21 | 22 | 23 | ## Flask 2.0 `async` or not `async` 24 | 25 | - asynchronous support in Flask 2.0 is an amazing feature 26 | - however, use it only when it has a clear advantage over the equivalent synchronous code 27 | - write asynchronous code, if your application's routes, etc. are making heavy I/O-bound operations, like: 28 | - sending emails, making API calls to external servers, working with the file system, etc 29 | - otherwise, if your application is doing CPU-bound operations or long-running tasks, like: 30 | - processing images or large files, creating backups or running AI/ML models, etc 31 | - it is advised to use tools like "Celery" or "Huey", etc. 32 | 33 | 34 | ## `async` demo in our application 35 | 36 | Check `emails/__init__.py` to see how emails being sent in `async` mode 37 | 38 | 39 | ## Primary Goals 40 | 41 | - To help you save lots of hours as a developer, even if for a hobby project or commercial project :-) 42 | - To provide basic features of standard web apps, while staying as unopinionated as possible 43 | - To make back-end development quick to start, with robust foundations 44 | - To help you quickly learn how to build a Flask based web application 45 | - To help you quick start coding your web app's main logic and features 46 | 47 | 48 | ## Table of Contents 49 | 50 | 1. [Getting Started](#getting-started) 51 | 1. [Screenshots](#screenshots) 52 | 1. [Project Structure](#project-structure) 53 | 1. [Modules](#modules) 54 | 1. [Testing](#testing) 55 | 1. [Need Help?](#need-help) 56 | 57 | 58 | ## Getting Started 59 | 60 | clone the project 61 | 62 | ```bash 63 | $ git clone https://github.com/ksh7/flask-starter.git 64 | $ cd flask-starter 65 | ``` 66 | 67 | create virtual environment using python3 and activate it (keep it outside our project directory) 68 | 69 | ```bash 70 | $ python3 -m venv /path/to/your/virtual/environment 71 | $ source /bin/activate 72 | ``` 73 | 74 | install dependencies in virtualenv 75 | 76 | ```bash 77 | $ pip install -r requirements.txt 78 | ``` 79 | 80 | setup `flask` command for our app 81 | 82 | ```bash 83 | $ export FLASK_APP=manage.py 84 | $ export FLASK_ENV=development 85 | ``` 86 | 87 | create instance folder in `/tmp` directory (sqlite database, temp files stay here) 88 | 89 | ```bash 90 | $ mkdir /tmp/flaskstarter-instance 91 | ``` 92 | 93 | initialize database and get two default users (admin & demo), check `manage.py` for details 94 | 95 | ```bash 96 | $ flask initdb 97 | ``` 98 | 99 | 5) start test server at `localhost:5000` 100 | 101 | ```bash 102 | $ flask run 103 | ``` 104 | 105 | ## Screenshots 106 | 107 | ![Homepage](/screenshots/homepage.png) 108 | ![SignUp](/screenshots/signup.png) 109 | ![Login](/screenshots/login.png) 110 | ![Dashboard](/screenshots/dashboard.png) 111 | ![Tasks](/screenshots/tasks.png) 112 | ![Profile](/screenshots/profile.png) 113 | ![Admin](/screenshots/admin.png) 114 | 115 | 116 | ## Project Structure 117 | 118 | ```bash 119 | flask-starter/ 120 | ├── flaskstarter 121 | │   ├── app.py 122 | │   ├── config.py 123 | │   ├── decorators.py 124 | │   ├── emails 125 | │   │   └── __init__.py 126 | │   ├── extensions.py 127 | │   ├── frontend 128 | │   │   ├── forms.py 129 | │   │   ├── __init__.py 130 | │   │   ├── models.py 131 | │   │   └── views.py 132 | │   ├── __init__.py 133 | │   ├── settings 134 | │   │   ├── forms.py 135 | │   │   ├── __init__.py 136 | │   │   └── views.py 137 | │   ├── static 138 | │   │   ├── bootstrap.bundle.min.js 139 | │   │   ├── bootstrap.min.css 140 | │   │   └── jquery.slim.min.js 141 | │   ├── tasks 142 | │   │   ├── forms.py 143 | │   │   ├── __init__.py 144 | │   │   ├── models.py 145 | │   │   └── views.py 146 | │   ├── templates 147 | │   │   ├── admin 148 | │   │   │   └── index.html 149 | │   │   ├── dashboard 150 | │   │   │   └── dashboard.html 151 | │   │   ├── frontend 152 | │   │   │   ├── change_password.html 153 | │   │   │   ├── contact_us.html 154 | │   │   │   ├── landing.html 155 | │   │   │   ├── login.html 156 | │   │   │   ├── reset_password.html 157 | │   │   │   └── signup.html 158 | │   │   ├── layouts 159 | │   │   │   ├── base.html 160 | │   │   │   └── header.html 161 | │   │   ├── macros 162 | │   │   │   ├── _confirm_account.html 163 | │   │   │   ├── _flash_msg.html 164 | │   │   │   ├── _form.html 165 | │   │   │   └── _reset_password.html 166 | │   │   ├── settings 167 | │   │   │   ├── password.html 168 | │   │   │   └── profile.html 169 | │   │   └── tasks 170 | │   │   ├── add_task.html 171 | │   │   ├── edit_task.html 172 | │   │   ├── my_tasks.html 173 | │   │   └── view_task.html 174 | │   ├── user 175 | │   │   ├── constants.py 176 | │   │   ├── __init__.py 177 | │   │   └── models.py 178 | │   └── utils.py 179 | ├── manage.py 180 | ├── README.md 181 | ├── requirements.txt 182 | ├── screenshots 183 | └── tests 184 | ├── __init__.py 185 | └── test_flaskstarter.py 186 | ``` 187 | 188 | 189 | ## Modules 190 | 191 | This application uses the following modules 192 | 193 | - Flask 194 | - Flask-SQLAlchemy 195 | - Flask-WTF 196 | - Flask-Mail 197 | - Flask-Caching 198 | - Flask-Login 199 | - Flask-Admin 200 | - pytest 201 | - Bootstrap (bare minimum so that you can replace it with any frontend library) 202 | - Jinja2 203 | 204 | 205 | ## Testing 206 | 207 | Note: This web application has been tested thoroughly during multiple large projects, however tests for this bare minimum version would be added in `tests` folder very soon to help you get started. 208 | 209 | ## Need Help? 🤝 210 | 211 | If you need further help, reach out to me via [Twitter](https://twitter.com/kundan7_) DM. 212 | -------------------------------------------------------------------------------- /flaskstarter/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .app import create_app 4 | -------------------------------------------------------------------------------- /flaskstarter/app.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from flask import Flask 4 | 5 | from .config import DefaultConfig 6 | from .user import Users, UsersAdmin 7 | from .settings import settings 8 | from .tasks import tasks, MyTaskModelAdmin 9 | from .frontend import frontend, ContactUsAdmin 10 | from .extensions import db, mail, cache, login_manager, admin 11 | from .utils import INSTANCE_FOLDER_PATH, pretty_date 12 | 13 | 14 | # For import * 15 | __all__ = ['create_app'] 16 | 17 | DEFAULT_BLUEPRINTS = ( 18 | frontend, 19 | settings, 20 | tasks 21 | ) 22 | 23 | 24 | def create_app(config=None, app_name=None, blueprints=None): 25 | # Create a Flask app 26 | 27 | if app_name is None: 28 | app_name = DefaultConfig.PROJECT 29 | if blueprints is None: 30 | blueprints = DEFAULT_BLUEPRINTS 31 | 32 | app = Flask(app_name, 33 | instance_path=INSTANCE_FOLDER_PATH, 34 | instance_relative_config=True) 35 | 36 | configure_app(app, config) 37 | configure_hook(app) 38 | configure_blueprints(app, blueprints) 39 | configure_extensions(app) 40 | configure_logging(app) 41 | configure_template_filters(app) 42 | configure_error_handlers(app) 43 | 44 | return app 45 | 46 | 47 | def configure_app(app, config=None): 48 | # Different ways of configurations i.e local or production 49 | 50 | app.config.from_object(DefaultConfig) 51 | 52 | app.config.from_pyfile('production.cfg', silent=True) 53 | 54 | if config: 55 | app.config.from_object(config) 56 | 57 | 58 | def configure_extensions(app): 59 | 60 | # flask-sqlalchemy 61 | db.init_app(app) 62 | 63 | # flask-mail 64 | mail.init_app(app) 65 | 66 | # flask-cache 67 | cache.init_app(app) 68 | 69 | # flask-admin 70 | admin.add_view(ContactUsAdmin(db.session)) 71 | admin.add_view(UsersAdmin(db.session)) 72 | admin.add_view(MyTaskModelAdmin(db.session)) 73 | admin.init_app(app) 74 | 75 | @login_manager.user_loader 76 | def load_user(id): 77 | return Users.query.get(id) 78 | login_manager.setup_app(app) 79 | 80 | 81 | def configure_blueprints(app, blueprints): 82 | # Configure blueprints in views 83 | 84 | for blueprint in blueprints: 85 | app.register_blueprint(blueprint) 86 | 87 | 88 | def configure_template_filters(app): 89 | 90 | @app.template_filter() 91 | def _pretty_date(value): 92 | return pretty_date(value) 93 | 94 | @app.template_filter() 95 | def format_date(value, format='%Y-%m-%d'): 96 | return value.strftime(format) 97 | 98 | 99 | def configure_logging(app): 100 | # Configure logging 101 | 102 | if app.debug: 103 | # Skip debug and test mode. Better check terminal output. 104 | return 105 | 106 | # TODO: production loggers for (info, email, etc) 107 | 108 | 109 | def configure_hook(app): 110 | @app.before_request 111 | def before_request(): 112 | pass 113 | 114 | 115 | def configure_error_handlers(app): 116 | 117 | @app.errorhandler(403) 118 | def forbidden_page(error): 119 | return "Oops! You don't have permission to access this page.", 403 120 | 121 | @app.errorhandler(404) 122 | def page_not_found(error): 123 | return "Opps! Page not found.", 404 124 | 125 | @app.errorhandler(500) 126 | def server_error_page(error): 127 | return "Oops! Internal server error. Please try after sometime.", 500 128 | -------------------------------------------------------------------------------- /flaskstarter/config.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | 5 | from .utils import INSTANCE_FOLDER_PATH 6 | 7 | 8 | class BaseConfig(object): 9 | # Change these settings as per your needs 10 | 11 | PROJECT = "flaskstarter" 12 | PROJECT_NAME = "flaskstarter.domain" 13 | PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 14 | 15 | BASE_URL = "https://yourdomain-flaskstarter.domain" 16 | ADMIN_EMAILS = ['admin@flaskstarter.domain'] 17 | 18 | DEBUG = False 19 | TESTING = False 20 | 21 | SECRET_KEY = 'always-change-this-secret-key-with-random-alpha-nums' 22 | 23 | 24 | class DefaultConfig(BaseConfig): 25 | 26 | DEBUG = True 27 | 28 | # Flask-Sqlalchemy 29 | SQLALCHEMY_ECHO = False 30 | SQLALCHEMY_TRACK_MODIFICATIONS = False 31 | 32 | # SQLITE for production 33 | SQLALCHEMY_DATABASE_URI = 'sqlite:///' + INSTANCE_FOLDER_PATH + '/db.sqlite' 34 | 35 | # POSTGRESQL for production 36 | # SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://postgres:pass@ip/dbname' 37 | 38 | # Flask-cache 39 | CACHE_TYPE = 'simple' 40 | CACHE_DEFAULT_TIMEOUT = 60 41 | 42 | # Flask-mail 43 | MAIL_DEBUG = False 44 | MAIL_SERVER = "" # something like 'smtp.gmail.com' 45 | MAIL_PORT = 587 46 | MAIL_USE_TLS = True 47 | 48 | # Keep these in instance folder or in env variables 49 | MAIL_USERNAME = "admin-mail@yourdomain-flaskstarter.domain" 50 | MAIL_PASSWORD = "" 51 | MAIL_DEFAULT_SENDER = MAIL_USERNAME 52 | -------------------------------------------------------------------------------- /flaskstarter/decorators.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from functools import wraps 4 | 5 | from flask import abort 6 | from flask_login import current_user 7 | 8 | 9 | def admin_required(f): 10 | @wraps(f) 11 | def decorated_function(*args, **kwargs): 12 | if not current_user.is_admin(): 13 | abort(403) 14 | return f(*args, **kwargs) 15 | return decorated_function 16 | -------------------------------------------------------------------------------- /flaskstarter/emails/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from flask_mail import Message 4 | 5 | from ..extensions import mail 6 | 7 | 8 | async def send_async_email(subject, html, send_to): 9 | """ send mail in async mode""" 10 | 11 | message = Message(subject=subject, html=html, recipients=[send_to]) 12 | await mail.send(message) 13 | -------------------------------------------------------------------------------- /flaskstarter/extensions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from flask_sqlalchemy import SQLAlchemy 4 | from flask_mail import Mail 5 | from flask_caching import Cache 6 | from flask_login import LoginManager 7 | from flask_admin import Admin, AdminIndexView 8 | from flask_admin.menu import MenuLink 9 | 10 | 11 | db = SQLAlchemy() 12 | 13 | mail = Mail() 14 | 15 | cache = Cache() 16 | 17 | login_manager = LoginManager() 18 | login_manager.login_view = "frontend.login" 19 | login_manager.login_message = "Please login or signup to add a new trip" 20 | 21 | 22 | class HomeView(AdminIndexView): 23 | def is_visible(self): 24 | return False 25 | 26 | # Config default flask-admin view 27 | 28 | 29 | admin = Admin(name='Flask-Starter Admin', template_mode='bootstrap3', index_view=HomeView(name='Home')) 30 | 31 | admin.add_link(MenuLink(name='Back to Dashboard', url='/dashboard', icon_type='glyph', icon_value='glyphicon-circle-arrow-left')) 32 | 33 | admin.add_link(MenuLink(name='Logout', url='/logout', icon_type='glyph', icon_value='glyphicon-log-out')) 34 | -------------------------------------------------------------------------------- /flaskstarter/frontend/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .models import ContactUs, ContactUsAdmin 4 | 5 | from .views import frontend 6 | -------------------------------------------------------------------------------- /flaskstarter/frontend/forms.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | from flask import Markup 5 | 6 | from flask_wtf import FlaskForm 7 | from wtforms import (ValidationError, HiddenField, BooleanField, StringField, 8 | PasswordField, SubmitField, TextAreaField, EmailField) 9 | from wtforms.validators import InputRequired, Length, EqualTo, Email 10 | 11 | from ..utils import (NAME_LEN_MIN, NAME_LEN_MAX, PASSWORD_LEN_MIN, 12 | PASSWORD_LEN_MAX) 13 | 14 | from ..user import Users 15 | 16 | terms_html = Markup('Terms of Service') 17 | 18 | 19 | class LoginForm(FlaskForm): 20 | next = HiddenField() 21 | login = StringField(u'Email', [InputRequired()]) 22 | password = PasswordField('Password', [InputRequired(), 23 | Length(PASSWORD_LEN_MIN, 24 | PASSWORD_LEN_MAX)]) 25 | remember = BooleanField('Remember me') 26 | submit = SubmitField('Sign in') 27 | 28 | 29 | class SignupForm(FlaskForm): 30 | next = HiddenField() 31 | name = StringField(u'Name', [InputRequired(), Length(NAME_LEN_MIN, NAME_LEN_MAX)]) 32 | email = EmailField(u'Email', [InputRequired(), Email()]) 33 | password = PasswordField(u'Password', 34 | [InputRequired(), Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX)], 35 | description=u' 6 or more characters.') 36 | agree = BooleanField(u'Agree to the ' + terms_html, [InputRequired()]) 37 | submit = SubmitField('Sign up') 38 | 39 | def validate_email(self, field): 40 | if Users.query.filter(Users.email.ilike(field.data)).first() is not None: 41 | raise ValidationError(u'This email is taken') 42 | 43 | 44 | class RecoverPasswordForm(FlaskForm): 45 | email = EmailField(u'Your email', [Email()]) 46 | submit = SubmitField('Send instructions') 47 | 48 | 49 | class ChangePasswordForm(FlaskForm): 50 | email_activation_key = HiddenField() 51 | email = HiddenField() 52 | password = PasswordField(u'Password', [InputRequired(),Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX)]) 53 | password_again = PasswordField(u'Password again', [EqualTo('password', message="Passwords don't match")]) 54 | submit = SubmitField('Save') 55 | 56 | 57 | class ContactUsForm(FlaskForm): 58 | name = StringField(u'Name', [InputRequired(), Length(max=64)]) 59 | email = EmailField(u'Your Email', [InputRequired(), Email(), Length(max=64)]) 60 | subject = StringField(u'Subject', [InputRequired(), Length(5, 128)]) 61 | message = TextAreaField(u'Your Message', [InputRequired(), Length(10, 1024)]) 62 | submit = SubmitField('Submit') 63 | -------------------------------------------------------------------------------- /flaskstarter/frontend/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from sqlalchemy import Column 4 | 5 | from ..extensions import db 6 | from ..utils import get_current_time 7 | 8 | from flask_login import current_user 9 | from flask_admin.contrib import sqla 10 | 11 | 12 | class ContactUs(db.Model): 13 | 14 | __tablename__ = 'contactus' 15 | 16 | id = Column(db.Integer, primary_key=True) 17 | name = Column(db.String(64), nullable=False) 18 | email = Column(db.String(64), nullable=False) 19 | subject = Column(db.String(128), nullable=False) 20 | message = Column(db.String(2048), nullable=False) 21 | 22 | received_time = Column(db.DateTime, default=get_current_time) 23 | 24 | def __unicode__(self): 25 | _str = '%s. %s %s' % (self.id, self.name, self.email) 26 | return str(_str) 27 | 28 | 29 | # Customized ContactUs model admin 30 | class ContactUsAdmin(sqla.ModelView): 31 | column_sortable_list = ('id', 'name', 'email', 'received_time') 32 | column_filters = ('id', 'name', 'email', 'received_time') 33 | 34 | def __init__(self, session): 35 | super(ContactUsAdmin, self).__init__(ContactUs, session) 36 | 37 | def is_accessible(self): 38 | if current_user.role == 'admin': 39 | return current_user.is_authenticated() 40 | -------------------------------------------------------------------------------- /flaskstarter/frontend/views.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from uuid import uuid4 4 | 5 | from itsdangerous import URLSafeSerializer 6 | 7 | from flask import (Blueprint, render_template, current_app, request, 8 | flash, url_for, redirect) 9 | from flask_login import (login_required, login_user, current_user, 10 | logout_user, login_fresh) 11 | 12 | 13 | from ..tasks import MyTaskForm 14 | from ..user import Users, ACTIVE 15 | from ..extensions import db, login_manager 16 | from .forms import (SignupForm, LoginForm, RecoverPasswordForm, 17 | ChangePasswordForm, ContactUsForm) 18 | from .models import ContactUs 19 | 20 | from ..emails import send_async_email 21 | 22 | 23 | frontend = Blueprint('frontend', __name__) 24 | 25 | 26 | @frontend.route('/dashboard') 27 | @login_required 28 | def dashboard(): 29 | 30 | _task_form = MyTaskForm() 31 | 32 | return render_template('dashboard/dashboard.html', task_form=_task_form, _active_dash=True) 33 | 34 | 35 | @frontend.route('/') 36 | def index(): 37 | # current_app.logger.debug('debug') 38 | 39 | if current_user.is_authenticated: 40 | return redirect(url_for('frontend.dashboard')) 41 | 42 | return render_template('frontend/landing.html', _active_home=True) 43 | 44 | 45 | @frontend.route('/contact-us', methods=['GET', 'POST']) 46 | def contact_us(): 47 | form = ContactUsForm() 48 | 49 | if form.validate_on_submit(): 50 | _contact = ContactUs() 51 | form.populate_obj(_contact) 52 | db.session.add(_contact) 53 | db.session.commit() 54 | 55 | flash('Thanks! We\'ll get back to you shortly!', 'success') 56 | 57 | return redirect(url_for('frontend.contact_us')) 58 | 59 | return render_template('frontend/contact_us.html', form=form) 60 | 61 | 62 | @frontend.route('/login', methods=['GET', 'POST']) 63 | def login(): 64 | if current_user.is_authenticated: 65 | return redirect(url_for('frontend.index')) 66 | 67 | form = LoginForm(login=request.args.get('login', None), 68 | next=request.args.get('next', None)) 69 | 70 | if form.validate_on_submit(): 71 | user, authenticated = Users.authenticate(form.login.data, form.password.data) 72 | 73 | if user and authenticated: 74 | 75 | if user.status_code != 2: 76 | flash("Please verify your email address to continue", "danger") 77 | return redirect(url_for('frontend.login')) 78 | 79 | remember = request.form.get('remember') == 'y' 80 | 81 | if login_user(user, remember=remember): 82 | flash("Logged in", 'success') 83 | return redirect(form.next.data or url_for('frontend.index')) 84 | else: 85 | flash('Sorry, invalid login', 'danger') 86 | 87 | return render_template('frontend/login.html', form=form, _active_login=True) 88 | 89 | 90 | @frontend.route('/logout') 91 | @login_required 92 | def logout(): 93 | logout_user() 94 | flash('Logged out', 'success') 95 | return redirect(url_for('frontend.index')) 96 | 97 | 98 | @frontend.route('/signup', methods=['GET', 'POST']) 99 | def signup(): 100 | if current_user.is_authenticated: 101 | return redirect(url_for('frontend.dashboard')) 102 | 103 | form = SignupForm(next=request.args.get('next')) 104 | 105 | if form.validate_on_submit(): 106 | user = Users() 107 | user.status_code = 2 108 | user.account_type = 0 109 | form.populate_obj(user) 110 | db.session.add(user) 111 | db.session.commit() 112 | 113 | confirm_user_mail(form.name.data, form.email.data) 114 | 115 | flash(u'Confirmation email sent to ' + form.email.data + ' Please verify!', 'success') 116 | return redirect(url_for('frontend.login')) 117 | 118 | return render_template('frontend/signup.html', form=form, 119 | _active_signup=True) 120 | 121 | 122 | def confirm_user_mail(name, email): 123 | s = URLSafeSerializer('serliaizer_code') 124 | key = s.dumps([name, email]) 125 | 126 | subject = 'Confirm your account for ' + current_app.config['PROJECT_NAME'] 127 | url = url_for('frontend.confirm_account', secretstring=key, _external=True) 128 | html = render_template('macros/_confirm_account.html', 129 | project=current_app.config['PROJECT_NAME'], 130 | url=url) 131 | 132 | send_async_email(subject, html, email) 133 | 134 | 135 | @frontend.route('/confirm_account/', methods=['GET', 'POST']) 136 | def confirm_account(secretstring): 137 | s = URLSafeSerializer('serliaizer_code') 138 | uname, uemail = s.loads(secretstring) 139 | user = Users.query.filter_by(name=uname).first() 140 | user.status_code = ACTIVE 141 | db.session.add(user) 142 | db.session.commit() 143 | flash(u'Your account was confirmed succsessfully!!!', 'success') 144 | return redirect(url_for('frontend.login')) 145 | 146 | 147 | @frontend.route('/change_password', methods=['GET', 'POST']) 148 | def change_password(): 149 | 150 | if current_user.is_authenticated: 151 | if not login_fresh(): 152 | return login_manager.needs_refresh() 153 | 154 | form = ChangePasswordForm(email_activation_key=request.values["email_activation_key"], 155 | email=request.values["email"]) 156 | 157 | if form.validate_on_submit(): 158 | update_password(form.email.data, form.email_activation_key.data, form.password.data) 159 | flash(u"Your password has been changed, log in again", "success") 160 | return redirect(url_for("frontend.login")) 161 | 162 | return render_template("frontend/change_password.html", form=form) 163 | 164 | 165 | def update_password(email, email_activation_key, password): 166 | user = Users.query.filter(Users.email.ilike(email), email_activation_key=email_activation_key).first() 167 | user.password = password 168 | user.email_activation_key = None 169 | db.session.add(user) 170 | db.session.commit() 171 | 172 | 173 | @frontend.route('/reset_password', methods=['GET', 'POST']) 174 | def reset_password(): 175 | form = RecoverPasswordForm() 176 | 177 | if form.validate_on_submit(): 178 | user = Users.query.filter(Users.email.ilike(form.email.data)).first() 179 | 180 | if user: 181 | flash('Please see your email for instructions on how to access your account', 'success') 182 | 183 | user.email_activation_key = str(uuid4()) 184 | db.session.add(user) 185 | db.session.commit() 186 | 187 | subject = 'Reset your password in ' + current_app.config['PROJECT_NAME'] 188 | url = url_for('frontend.change_password', email=user.email, 189 | email_activation_key=user.email_activation_key, _external=True) 190 | html = render_template('macros/_reset_password.html', project=current_app.config['PROJECT_NAME'], 191 | name=user.name, url=url) 192 | 193 | send_async_email(subject, html, user.email) 194 | 195 | return render_template('frontend/reset_password.html', form=form) 196 | else: 197 | flash('Sorry, no user found for that email address', 'danger') 198 | 199 | return render_template('frontend/reset_password.html', form=form) 200 | 201 | 202 | @frontend.route('/terms') 203 | def terms(): 204 | return "To be updated soon.." 205 | 206 | 207 | @frontend.route('/about-us') 208 | def about_us(): 209 | return "To be updated soon.." 210 | -------------------------------------------------------------------------------- /flaskstarter/settings/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .views import settings 4 | -------------------------------------------------------------------------------- /flaskstarter/settings/forms.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from flask_wtf import FlaskForm 4 | from wtforms import ValidationError, StringField, PasswordField, SubmitField, EmailField 5 | from wtforms.validators import (InputRequired, Length, EqualTo, Email) 6 | from flask_login import current_user 7 | 8 | from ..user import Users 9 | from ..utils import PASSWORD_LEN_MIN, PASSWORD_LEN_MAX 10 | 11 | 12 | class ProfileForm(FlaskForm): 13 | multipart = True 14 | name = StringField(u'Name', [Length(max=50)]) 15 | email = EmailField(u'Email', [InputRequired(), Email()]) 16 | submit = SubmitField(u'Update') 17 | 18 | def validate_email(self, field): 19 | if Users.query.filter(Users.email.ilike(field.data), Users.id != current_user.id).first() is not None: 20 | raise ValidationError(u'This email is taken') 21 | 22 | 23 | class PasswordForm(FlaskForm): 24 | password = PasswordField('Current password', [InputRequired()]) 25 | new_password = PasswordField('New password', [InputRequired(), Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX)]) 26 | password_again = PasswordField('Password again', [InputRequired(), Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX), EqualTo('new_password')]) 27 | submit = SubmitField(u'Update') 28 | 29 | def validate_password(form, field): 30 | user = Users.get_by_id(current_user.id) 31 | if not user.check_password(field.data): 32 | raise ValidationError("Password is wrong") 33 | -------------------------------------------------------------------------------- /flaskstarter/settings/views.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from flask import Blueprint, render_template, request, flash 4 | from flask_login import login_required, current_user 5 | 6 | from ..extensions import db 7 | from ..user import Users 8 | from .forms import ProfileForm, PasswordForm 9 | 10 | 11 | settings = Blueprint('settings', __name__, url_prefix='/settings') 12 | 13 | 14 | @settings.route('/profile', methods=['GET', 'POST']) 15 | @login_required 16 | def profile(): 17 | user = Users.query.filter_by(email=current_user.email).first_or_404() 18 | form = ProfileForm(obj=user, 19 | email=current_user.email, 20 | role_code=current_user.role_code, 21 | status_code=current_user.status_code) 22 | 23 | if form.validate_on_submit(): 24 | 25 | form.populate_obj(user) 26 | 27 | db.session.add(user) 28 | db.session.commit() 29 | 30 | flash('Profile Changes Saved!', 'success') 31 | 32 | return render_template('settings/profile.html', 33 | user=user, active="profile", form=form) 34 | 35 | 36 | @settings.route('/password', methods=['GET', 'POST']) 37 | @login_required 38 | def password(): 39 | user = Users.query.filter_by(email=current_user.email).first_or_404() 40 | form = PasswordForm(next=request.args.get('next')) 41 | 42 | if form.validate_on_submit(): 43 | form.populate_obj(user) 44 | user.password = form.new_password.data 45 | 46 | db.session.add(user) 47 | db.session.commit() 48 | 49 | flash('Password updated.', 'success') 50 | 51 | return render_template('settings/password.html', 52 | user=user, active="password", form=form) 53 | -------------------------------------------------------------------------------- /flaskstarter/static/bootstrap.bundle.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v4.5.3 (https://getbootstrap.com/) 3 | * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 | */ 6 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap={},t.jQuery)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function o(t,e){for(var n=0;n=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};l.jQueryDetection(),i.default.fn.emulateTransitionEnd=s,i.default.event.special[l.TRANSITION_END]={bindType:"transitionend",delegateType:"transitionend",handle:function(t){if(i.default(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var u="alert",f=i.default.fn[u],d=function(){function t(t){this._element=t}var e=t.prototype;return e.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},e.dispose=function(){i.default.removeData(this._element,"bs.alert"),this._element=null},e._getRootElement=function(t){var e=l.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=i.default(t).closest(".alert")[0]),n},e._triggerCloseEvent=function(t){var e=i.default.Event("close.bs.alert");return i.default(t).trigger(e),e},e._removeElement=function(t){var e=this;if(i.default(t).removeClass("show"),i.default(t).hasClass("fade")){var n=l.getTransitionDurationFromElement(t);i.default(t).one(l.TRANSITION_END,(function(n){return e._destroyElement(t,n)})).emulateTransitionEnd(n)}else this._destroyElement(t)},e._destroyElement=function(t){i.default(t).detach().trigger("closed.bs.alert").remove()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.alert");o||(o=new t(this),n.data("bs.alert",o)),"close"===e&&o[e](this)}))},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}}]),t}();i.default(document).on("click.bs.alert.data-api",'[data-dismiss="alert"]',d._handleDismiss(new d)),i.default.fn[u]=d._jQueryInterface,i.default.fn[u].Constructor=d,i.default.fn[u].noConflict=function(){return i.default.fn[u]=f,d._jQueryInterface};var c=i.default.fn.button,h=function(){function t(t){this._element=t,this.shouldAvoidTriggerChange=!1}var e=t.prototype;return e.toggle=function(){var t=!0,e=!0,n=i.default(this._element).closest('[data-toggle="buttons"]')[0];if(n){var o=this._element.querySelector('input:not([type="hidden"])');if(o){if("radio"===o.type)if(o.checked&&this._element.classList.contains("active"))t=!1;else{var r=n.querySelector(".active");r&&i.default(r).removeClass("active")}t&&("checkbox"!==o.type&&"radio"!==o.type||(o.checked=!this._element.classList.contains("active")),this.shouldAvoidTriggerChange||i.default(o).trigger("change")),o.focus(),e=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(e&&this._element.setAttribute("aria-pressed",!this._element.classList.contains("active")),t&&i.default(this._element).toggleClass("active"))},e.dispose=function(){i.default.removeData(this._element,"bs.button"),this._element=null},t._jQueryInterface=function(e,n){return this.each((function(){var o=i.default(this),r=o.data("bs.button");r||(r=new t(this),o.data("bs.button",r)),r.shouldAvoidTriggerChange=n,"toggle"===e&&r[e]()}))},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}}]),t}();i.default(document).on("click.bs.button.data-api",'[data-toggle^="button"]',(function(t){var e=t.target,n=e;if(i.default(e).hasClass("btn")||(e=i.default(e).closest(".btn")[0]),!e||e.hasAttribute("disabled")||e.classList.contains("disabled"))t.preventDefault();else{var o=e.querySelector('input:not([type="hidden"])');if(o&&(o.hasAttribute("disabled")||o.classList.contains("disabled")))return void t.preventDefault();"INPUT"!==n.tagName&&"LABEL"===e.tagName||h._jQueryInterface.call(i.default(e),"toggle","INPUT"===n.tagName)}})).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',(function(t){var e=i.default(t.target).closest(".btn")[0];i.default(e).toggleClass("focus",/^focus(in)?$/.test(t.type))})),i.default(window).on("load.bs.button.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-toggle="buttons"] .btn')),e=0,n=t.length;e0,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var e=t.prototype;return e.next=function(){this._isSliding||this._slide("next")},e.nextWhenVisible=function(){var t=i.default(this._element);!document.hidden&&t.is(":visible")&&"hidden"!==t.css("visibility")&&this.next()},e.prev=function(){this._isSliding||this._slide("prev")},e.pause=function(t){t||(this._isPaused=!0),this._element.querySelector(".carousel-item-next, .carousel-item-prev")&&(l.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},e.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},e.to=function(t){var e=this;this._activeElement=this._element.querySelector(".active.carousel-item");var n=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)i.default(this._element).one("slid.bs.carousel",(function(){return e.to(t)}));else{if(n===t)return this.pause(),void this.cycle();var o=t>n?"next":"prev";this._slide(o,this._items[t])}},e.dispose=function(){i.default(this._element).off(m),i.default.removeData(this._element,"bs.carousel"),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},e._getConfig=function(t){return t=a({},v,t),l.typeCheckConfig(p,t,_),t},e._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}},e._addEventListeners=function(){var t=this;this._config.keyboard&&i.default(this._element).on("keydown.bs.carousel",(function(e){return t._keydown(e)})),"hover"===this._config.pause&&i.default(this._element).on("mouseenter.bs.carousel",(function(e){return t.pause(e)})).on("mouseleave.bs.carousel",(function(e){return t.cycle(e)})),this._config.touch&&this._addTouchEventListeners()},e._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var e=function(e){t._pointerEvent&&b[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},n=function(e){t._pointerEvent&&b[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout((function(e){return t.cycle(e)}),500+t._config.interval))};i.default(this._element.querySelectorAll(".carousel-item img")).on("dragstart.bs.carousel",(function(t){return t.preventDefault()})),this._pointerEvent?(i.default(this._element).on("pointerdown.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("pointerup.bs.carousel",(function(t){return n(t)})),this._element.classList.add("pointer-event")):(i.default(this._element).on("touchstart.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("touchmove.bs.carousel",(function(e){return function(e){e.originalEvent.touches&&e.originalEvent.touches.length>1?t.touchDeltaX=0:t.touchDeltaX=e.originalEvent.touches[0].clientX-t.touchStartX}(e)})),i.default(this._element).on("touchend.bs.carousel",(function(t){return n(t)})))}},e._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},e._getItemIndex=function(t){return this._items=t&&t.parentNode?[].slice.call(t.parentNode.querySelectorAll(".carousel-item")):[],this._items.indexOf(t)},e._getItemByDirection=function(t,e){var n="next"===t,i="prev"===t,o=this._getItemIndex(e),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return e;var a=(o+("prev"===t?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]},e._triggerSlideEvent=function(t,e){var n=this._getItemIndex(t),o=this._getItemIndex(this._element.querySelector(".active.carousel-item")),r=i.default.Event("slide.bs.carousel",{relatedTarget:t,direction:e,from:o,to:n});return i.default(this._element).trigger(r),r},e._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var e=[].slice.call(this._indicatorsElement.querySelectorAll(".active"));i.default(e).removeClass("active");var n=this._indicatorsElement.children[this._getItemIndex(t)];n&&i.default(n).addClass("active")}},e._slide=function(t,e){var n,o,r,a=this,s=this._element.querySelector(".active.carousel-item"),u=this._getItemIndex(s),f=e||s&&this._getItemByDirection(t,s),d=this._getItemIndex(f),c=Boolean(this._interval);if("next"===t?(n="carousel-item-left",o="carousel-item-next",r="left"):(n="carousel-item-right",o="carousel-item-prev",r="right"),f&&i.default(f).hasClass("active"))this._isSliding=!1;else if(!this._triggerSlideEvent(f,r).isDefaultPrevented()&&s&&f){this._isSliding=!0,c&&this.pause(),this._setActiveIndicatorElement(f);var h=i.default.Event("slid.bs.carousel",{relatedTarget:f,direction:r,from:u,to:d});if(i.default(this._element).hasClass("slide")){i.default(f).addClass(o),l.reflow(f),i.default(s).addClass(n),i.default(f).addClass(n);var p=parseInt(f.getAttribute("data-interval"),10);p?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=p):this._config.interval=this._config.defaultInterval||this._config.interval;var m=l.getTransitionDurationFromElement(s);i.default(s).one(l.TRANSITION_END,(function(){i.default(f).removeClass(n+" "+o).addClass("active"),i.default(s).removeClass("active "+o+" "+n),a._isSliding=!1,setTimeout((function(){return i.default(a._element).trigger(h)}),0)})).emulateTransitionEnd(m)}else i.default(s).removeClass("active"),i.default(f).addClass("active"),this._isSliding=!1,i.default(this._element).trigger(h);c&&this.cycle()}},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data("bs.carousel"),o=a({},v,i.default(this).data());"object"==typeof e&&(o=a({},o,e));var r="string"==typeof e?e:o.slide;if(n||(n=new t(this,o),i.default(this).data("bs.carousel",n)),"number"==typeof e)n.to(e);else if("string"==typeof r){if("undefined"==typeof n[r])throw new TypeError('No method named "'+r+'"');n[r]()}else o.interval&&o.ride&&(n.pause(),n.cycle())}))},t._dataApiClickHandler=function(e){var n=l.getSelectorFromElement(this);if(n){var o=i.default(n)[0];if(o&&i.default(o).hasClass("carousel")){var r=a({},i.default(o).data(),i.default(this).data()),s=this.getAttribute("data-slide-to");s&&(r.interval=!1),t._jQueryInterface.call(i.default(o),r),s&&i.default(o).data("bs.carousel").to(s),e.preventDefault()}}},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}},{key:"Default",get:function(){return v}}]),t}();i.default(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",y._dataApiClickHandler),i.default(window).on("load.bs.carousel.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-ride="carousel"]')),e=0,n=t.length;e0&&(this._selector=a,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var e=t.prototype;return e.toggle=function(){i.default(this._element).hasClass("show")?this.hide():this.show()},e.show=function(){var e,n,o=this;if(!this._isTransitioning&&!i.default(this._element).hasClass("show")&&(this._parent&&0===(e=[].slice.call(this._parent.querySelectorAll(".show, .collapsing")).filter((function(t){return"string"==typeof o._config.parent?t.getAttribute("data-parent")===o._config.parent:t.classList.contains("collapse")}))).length&&(e=null),!(e&&(n=i.default(e).not(this._selector).data("bs.collapse"))&&n._isTransitioning))){var r=i.default.Event("show.bs.collapse");if(i.default(this._element).trigger(r),!r.isDefaultPrevented()){e&&(t._jQueryInterface.call(i.default(e).not(this._selector),"hide"),n||i.default(e).data("bs.collapse",null));var a=this._getDimension();i.default(this._element).removeClass("collapse").addClass("collapsing"),this._element.style[a]=0,this._triggerArray.length&&i.default(this._triggerArray).removeClass("collapsed").attr("aria-expanded",!0),this.setTransitioning(!0);var s="scroll"+(a[0].toUpperCase()+a.slice(1)),u=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,(function(){i.default(o._element).removeClass("collapsing").addClass("collapse show"),o._element.style[a]="",o.setTransitioning(!1),i.default(o._element).trigger("shown.bs.collapse")})).emulateTransitionEnd(u),this._element.style[a]=this._element[s]+"px"}}},e.hide=function(){var t=this;if(!this._isTransitioning&&i.default(this._element).hasClass("show")){var e=i.default.Event("hide.bs.collapse");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",l.reflow(this._element),i.default(this._element).addClass("collapsing").removeClass("collapse show");var o=this._triggerArray.length;if(o>0)for(var r=0;r=0)return 1;return 0}();var k=D&&window.Promise?function(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then((function(){e=!1,t()})))}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout((function(){e=!1,t()}),N))}};function A(t){return t&&"[object Function]"==={}.toString.call(t)}function I(t,e){if(1!==t.nodeType)return[];var n=t.ownerDocument.defaultView.getComputedStyle(t,null);return e?n[e]:n}function O(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function x(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=I(t),n=e.overflow,i=e.overflowX,o=e.overflowY;return/(auto|scroll|overlay)/.test(n+o+i)?t:x(O(t))}function j(t){return t&&t.referenceNode?t.referenceNode:t}var L=D&&!(!window.MSInputMethodContext||!document.documentMode),P=D&&/MSIE 10/.test(navigator.userAgent);function F(t){return 11===t?L:10===t?P:L||P}function R(t){if(!t)return document.documentElement;for(var e=F(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===I(n,"position")?R(n):n:t?t.ownerDocument.documentElement:document.documentElement}function H(t){return null!==t.parentNode?H(t.parentNode):t}function M(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?t:e,o=n?e:t,r=document.createRange();r.setStart(i,0),r.setEnd(o,0);var a,s,l=r.commonAncestorContainer;if(t!==l&&e!==l||i.contains(o))return"BODY"===(s=(a=l).nodeName)||"HTML"!==s&&R(a.firstElementChild)!==a?R(l):l;var u=H(t);return u.host?M(u.host,e):M(t,H(e).host)}function B(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===e?"scrollTop":"scrollLeft",i=t.nodeName;if("BODY"===i||"HTML"===i){var o=t.ownerDocument.documentElement,r=t.ownerDocument.scrollingElement||o;return r[n]}return t[n]}function q(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=B(e,"top"),o=B(e,"left"),r=n?-1:1;return t.top+=i*r,t.bottom+=i*r,t.left+=o*r,t.right+=o*r,t}function Q(t,e){var n="x"===e?"Left":"Top",i="Left"===n?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+i+"Width"])}function W(t,e,n,i){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],F(10)?parseInt(n["offset"+t])+parseInt(i["margin"+("Height"===t?"Top":"Left")])+parseInt(i["margin"+("Height"===t?"Bottom":"Right")]):0)}function U(t){var e=t.body,n=t.documentElement,i=F(10)&&getComputedStyle(n);return{height:W("Height",e,n,i),width:W("Width",e,n,i)}}var V=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Y=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2],i=F(10),o="HTML"===e.nodeName,r=G(t),a=G(e),s=x(t),l=I(e),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var d=K({top:r.top-a.top-u,left:r.left-a.left-f,width:r.width,height:r.height});if(d.marginTop=0,d.marginLeft=0,!i&&o){var c=parseFloat(l.marginTop),h=parseFloat(l.marginLeft);d.top-=u-c,d.bottom-=u-c,d.left-=f-h,d.right-=f-h,d.marginTop=c,d.marginLeft=h}return(i&&!n?e.contains(s):e===s&&"BODY"!==s.nodeName)&&(d=q(d,e)),d}function J(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.ownerDocument.documentElement,i=$(t,n),o=Math.max(n.clientWidth,window.innerWidth||0),r=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:B(n),s=e?0:B(n,"left"),l={top:a-i.top+i.marginTop,left:s-i.left+i.marginLeft,width:o,height:r};return K(l)}function Z(t){var e=t.nodeName;if("BODY"===e||"HTML"===e)return!1;if("fixed"===I(t,"position"))return!0;var n=O(t);return!!n&&Z(n)}function tt(t){if(!t||!t.parentElement||F())return document.documentElement;for(var e=t.parentElement;e&&"none"===I(e,"transform");)e=e.parentElement;return e||document.documentElement}function et(t,e,n,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r={top:0,left:0},a=o?tt(t):M(t,j(e));if("viewport"===i)r=J(a,o);else{var s=void 0;"scrollParent"===i?"BODY"===(s=x(O(e))).nodeName&&(s=t.ownerDocument.documentElement):s="window"===i?t.ownerDocument.documentElement:i;var l=$(s,a,o);if("HTML"!==s.nodeName||Z(a))r=l;else{var u=U(t.ownerDocument),f=u.height,d=u.width;r.top+=l.top-l.marginTop,r.bottom=f+l.top,r.left+=l.left-l.marginLeft,r.right=d+l.left}}var c="number"==typeof(n=n||0);return r.left+=c?n:n.left||0,r.top+=c?n:n.top||0,r.right-=c?n:n.right||0,r.bottom-=c?n:n.bottom||0,r}function nt(t){return t.width*t.height}function it(t,e,n,i,o){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===t.indexOf("auto"))return t;var a=et(n,i,r,o),s={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},l=Object.keys(s).map((function(t){return X({key:t},s[t],{area:nt(s[t])})})).sort((function(t,e){return e.area-t.area})),u=l.filter((function(t){var e=t.width,i=t.height;return e>=n.clientWidth&&i>=n.clientHeight})),f=u.length>0?u[0].key:l[0].key,d=t.split("-")[1];return f+(d?"-"+d:"")}function ot(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=i?tt(e):M(e,j(n));return $(n,o,i)}function rt(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.marginTop||0)+parseFloat(e.marginBottom||0),i=parseFloat(e.marginLeft||0)+parseFloat(e.marginRight||0);return{width:t.offsetWidth+i,height:t.offsetHeight+n}}function at(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,(function(t){return e[t]}))}function st(t,e,n){n=n.split("-")[0];var i=rt(t),o={width:i.width,height:i.height},r=-1!==["right","left"].indexOf(n),a=r?"top":"left",s=r?"left":"top",l=r?"height":"width",u=r?"width":"height";return o[a]=e[a]+e[l]/2-i[l]/2,o[s]=n===s?e[s]-i[u]:e[at(s)],o}function lt(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function ut(t,e,n){return(void 0===n?t:t.slice(0,function(t,e,n){if(Array.prototype.findIndex)return t.findIndex((function(t){return t[e]===n}));var i=lt(t,(function(t){return t[e]===n}));return t.indexOf(i)}(t,"name",n))).forEach((function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var n=t.function||t.fn;t.enabled&&A(n)&&(e.offsets.popper=K(e.offsets.popper),e.offsets.reference=K(e.offsets.reference),e=n(e,t))})),e}function ft(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=ot(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=it(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=st(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=ut(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function dt(t,e){return t.some((function(t){var n=t.name;return t.enabled&&n===e}))}function ct(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),i=0;i1&&void 0!==arguments[1]&&arguments[1],n=Tt.indexOf(t),i=Tt.slice(n+1).concat(Tt.slice(0,n));return e?i.reverse():i}var St="flip",Dt="clockwise",Nt="counterclockwise";function kt(t,e,n,i){var o=[0,0],r=-1!==["right","left"].indexOf(i),a=t.split(/(\+|\-)/).map((function(t){return t.trim()})),s=a.indexOf(lt(a,(function(t){return-1!==t.search(/,|\s/)})));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=-1!==s?[a.slice(0,s).concat([a[s].split(l)[0]]),[a[s].split(l)[1]].concat(a.slice(s+1))]:[a];return(u=u.map((function(t,i){var o=(1===i?!r:r)?"height":"width",a=!1;return t.reduce((function(t,e){return""===t[t.length-1]&&-1!==["+","-"].indexOf(e)?(t[t.length-1]=e,a=!0,t):a?(t[t.length-1]+=e,a=!1,t):t.concat(e)}),[]).map((function(t){return function(t,e,n,i){var o=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+o[1],a=o[2];if(!r)return t;if(0===a.indexOf("%")){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=i}return K(s)[e]/100*r}if("vh"===a||"vw"===a){return("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r}return r}(t,o,e,n)}))}))).forEach((function(t,e){t.forEach((function(n,i){_t(n)&&(o[e]+=n*("-"===t[i-1]?-1:1))}))})),o}var At={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(t){var e=t.placement,n=e.split("-")[0],i=e.split("-")[1];if(i){var o=t.offsets,r=o.reference,a=o.popper,s=-1!==["bottom","top"].indexOf(n),l=s?"left":"top",u=s?"width":"height",f={start:z({},l,r[l]),end:z({},l,r[l]+r[u]-a[u])};t.offsets.popper=X({},a,f[i])}return t}},offset:{order:200,enabled:!0,fn:function(t,e){var n=e.offset,i=t.placement,o=t.offsets,r=o.popper,a=o.reference,s=i.split("-")[0],l=void 0;return l=_t(+n)?[+n,0]:kt(n,r,a,s),"left"===s?(r.top+=l[0],r.left-=l[1]):"right"===s?(r.top+=l[0],r.left+=l[1]):"top"===s?(r.left+=l[0],r.top-=l[1]):"bottom"===s&&(r.left+=l[0],r.top+=l[1]),t.popper=r,t},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(t,e){var n=e.boundariesElement||R(t.instance.popper);t.instance.reference===n&&(n=R(n));var i=ct("transform"),o=t.instance.popper.style,r=o.top,a=o.left,s=o[i];o.top="",o.left="",o[i]="";var l=et(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);o.top=r,o.left=a,o[i]=s,e.boundaries=l;var u=e.priority,f=t.offsets.popper,d={primary:function(t){var n=f[t];return f[t]l[t]&&!e.escapeWithReference&&(i=Math.min(f[n],l[t]-("right"===t?f.width:f.height))),z({},n,i)}};return u.forEach((function(t){var e=-1!==["left","top"].indexOf(t)?"primary":"secondary";f=X({},f,d[e](t))})),t.offsets.popper=f,t},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(t){var e=t.offsets,n=e.popper,i=e.reference,o=t.placement.split("-")[0],r=Math.floor,a=-1!==["top","bottom"].indexOf(o),s=a?"right":"bottom",l=a?"left":"top",u=a?"width":"height";return n[s]r(i[s])&&(t.offsets.popper[l]=r(i[s])),t}},arrow:{order:500,enabled:!0,fn:function(t,e){var n;if(!wt(t.instance.modifiers,"arrow","keepTogether"))return t;var i=e.element;if("string"==typeof i){if(!(i=t.instance.popper.querySelector(i)))return t}else if(!t.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var o=t.placement.split("-")[0],r=t.offsets,a=r.popper,s=r.reference,l=-1!==["left","right"].indexOf(o),u=l?"height":"width",f=l?"Top":"Left",d=f.toLowerCase(),c=l?"left":"top",h=l?"bottom":"right",p=rt(i)[u];s[h]-pa[h]&&(t.offsets.popper[d]+=s[d]+p-a[h]),t.offsets.popper=K(t.offsets.popper);var m=s[d]+s[u]/2-p/2,g=I(t.instance.popper),v=parseFloat(g["margin"+f]),_=parseFloat(g["border"+f+"Width"]),b=m-t.offsets.popper[d]-v-_;return b=Math.max(Math.min(a[u]-p,b),0),t.arrowElement=i,t.offsets.arrow=(z(n={},d,Math.round(b)),z(n,c,""),n),t},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(t,e){if(dt(t.instance.modifiers,"inner"))return t;if(t.flipped&&t.placement===t.originalPlacement)return t;var n=et(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),i=t.placement.split("-")[0],o=at(i),r=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case St:a=[i,o];break;case Dt:a=Ct(i);break;case Nt:a=Ct(i,!0);break;default:a=e.behavior}return a.forEach((function(s,l){if(i!==s||a.length===l+1)return t;i=t.placement.split("-")[0],o=at(i);var u=t.offsets.popper,f=t.offsets.reference,d=Math.floor,c="left"===i&&d(u.right)>d(f.left)||"right"===i&&d(u.left)d(f.top)||"bottom"===i&&d(u.top)d(n.right),m=d(u.top)d(n.bottom),v="left"===i&&h||"right"===i&&p||"top"===i&&m||"bottom"===i&&g,_=-1!==["top","bottom"].indexOf(i),b=!!e.flipVariations&&(_&&"start"===r&&h||_&&"end"===r&&p||!_&&"start"===r&&m||!_&&"end"===r&&g),y=!!e.flipVariationsByContent&&(_&&"start"===r&&p||_&&"end"===r&&h||!_&&"start"===r&&g||!_&&"end"===r&&m),w=b||y;(c||v||w)&&(t.flipped=!0,(c||v)&&(i=a[l+1]),w&&(r=function(t){return"end"===t?"start":"start"===t?"end":t}(r)),t.placement=i+(r?"-"+r:""),t.offsets.popper=X({},t.offsets.popper,st(t.instance.popper,t.offsets.reference,t.placement)),t=ut(t.instance.modifiers,t,"flip"))})),t},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(t){var e=t.placement,n=e.split("-")[0],i=t.offsets,o=i.popper,r=i.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return o[a?"left":"top"]=r[n]-(s?o[a?"width":"height"]:0),t.placement=at(e),t.offsets.popper=K(o),t}},hide:{order:800,enabled:!0,fn:function(t){if(!wt(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=lt(t.instance.modifiers,(function(t){return"preventOverflow"===t.name})).boundaries;if(e.bottomn.right||e.top>n.bottom||e.right2&&void 0!==arguments[2]?arguments[2]:{};V(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(i.update)},this.update=k(this.update.bind(this)),this.options=X({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(X({},t.Defaults.modifiers,o.modifiers)).forEach((function(e){i.options.modifiers[e]=X({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(t){return X({name:t},i.options.modifiers[t])})).sort((function(t,e){return t.order-e.order})),this.modifiers.forEach((function(t){t.enabled&&A(t.onLoad)&&t.onLoad(i.reference,i.popper,i.options,t,i.state)})),this.update();var r=this.options.eventsEnabled;r&&this.enableEventListeners(),this.state.eventsEnabled=r}return Y(t,[{key:"update",value:function(){return ft.call(this)}},{key:"destroy",value:function(){return ht.call(this)}},{key:"enableEventListeners",value:function(){return gt.call(this)}},{key:"disableEventListeners",value:function(){return vt.call(this)}}]),t}();It.Utils=("undefined"!=typeof window?window:global).PopperUtils,It.placements=Et,It.Defaults=At;var Ot="dropdown",xt=i.default.fn[Ot],jt=new RegExp("38|40|27"),Lt={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},Pt={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},Ft=function(){function t(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var e=t.prototype;return e.toggle=function(){if(!this._element.disabled&&!i.default(this._element).hasClass("disabled")){var e=i.default(this._menu).hasClass("show");t._clearMenus(),e||this.show(!0)}},e.show=function(e){if(void 0===e&&(e=!1),!(this._element.disabled||i.default(this._element).hasClass("disabled")||i.default(this._menu).hasClass("show"))){var n={relatedTarget:this._element},o=i.default.Event("show.bs.dropdown",n),r=t._getParentFromElement(this._element);if(i.default(r).trigger(o),!o.isDefaultPrevented()){if(!this._inNavbar&&e){if("undefined"==typeof It)throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org/)");var a=this._element;"parent"===this._config.reference?a=r:l.isElement(this._config.reference)&&(a=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(a=this._config.reference[0])),"scrollParent"!==this._config.boundary&&i.default(r).addClass("position-static"),this._popper=new It(a,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===i.default(r).closest(".navbar-nav").length&&i.default(document.body).children().on("mouseover",null,i.default.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),i.default(this._menu).toggleClass("show"),i.default(r).toggleClass("show").trigger(i.default.Event("shown.bs.dropdown",n))}}},e.hide=function(){if(!this._element.disabled&&!i.default(this._element).hasClass("disabled")&&i.default(this._menu).hasClass("show")){var e={relatedTarget:this._element},n=i.default.Event("hide.bs.dropdown",e),o=t._getParentFromElement(this._element);i.default(o).trigger(n),n.isDefaultPrevented()||(this._popper&&this._popper.destroy(),i.default(this._menu).toggleClass("show"),i.default(o).toggleClass("show").trigger(i.default.Event("hidden.bs.dropdown",e)))}},e.dispose=function(){i.default.removeData(this._element,"bs.dropdown"),i.default(this._element).off(".bs.dropdown"),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},e.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},e._addEventListeners=function(){var t=this;i.default(this._element).on("click.bs.dropdown",(function(e){e.preventDefault(),e.stopPropagation(),t.toggle()}))},e._getConfig=function(t){return t=a({},this.constructor.Default,i.default(this._element).data(),t),l.typeCheckConfig(Ot,t,this.constructor.DefaultType),t},e._getMenuElement=function(){if(!this._menu){var e=t._getParentFromElement(this._element);e&&(this._menu=e.querySelector(".dropdown-menu"))}return this._menu},e._getPlacement=function(){var t=i.default(this._element.parentNode),e="bottom-start";return t.hasClass("dropup")?e=i.default(this._menu).hasClass("dropdown-menu-right")?"top-end":"top-start":t.hasClass("dropright")?e="right-start":t.hasClass("dropleft")?e="left-start":i.default(this._menu).hasClass("dropdown-menu-right")&&(e="bottom-end"),e},e._detectNavbar=function(){return i.default(this._element).closest(".navbar").length>0},e._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t._config.offset(e.offsets,t._element)||{}),e}:e.offset=this._config.offset,e},e._getPopperConfig=function(){var t={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(t.modifiers.applyStyle={enabled:!1}),a({},t,this._config.popperConfig)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data("bs.dropdown");if(n||(n=new t(this,"object"==typeof e?e:null),i.default(this).data("bs.dropdown",n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}}))},t._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var n=[].slice.call(document.querySelectorAll('[data-toggle="dropdown"]')),o=0,r=n.length;o0&&a--,40===e.which&&adocument.documentElement.clientHeight;n||(this._element.style.overflowY="hidden"),this._element.classList.add("modal-static");var o=l.getTransitionDurationFromElement(this._dialog);i.default(this._element).off(l.TRANSITION_END),i.default(this._element).one(l.TRANSITION_END,(function(){t._element.classList.remove("modal-static"),n||i.default(t._element).one(l.TRANSITION_END,(function(){t._element.style.overflowY=""})).emulateTransitionEnd(t._element,o)})).emulateTransitionEnd(o),this._element.focus()}else this.hide()},e._showElement=function(t){var e=this,n=i.default(this._element).hasClass("fade"),o=this._dialog?this._dialog.querySelector(".modal-body"):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),i.default(this._dialog).hasClass("modal-dialog-scrollable")&&o?o.scrollTop=0:this._element.scrollTop=0,n&&l.reflow(this._element),i.default(this._element).addClass("show"),this._config.focus&&this._enforceFocus();var r=i.default.Event("shown.bs.modal",{relatedTarget:t}),a=function(){e._config.focus&&e._element.focus(),e._isTransitioning=!1,i.default(e._element).trigger(r)};if(n){var s=l.getTransitionDurationFromElement(this._dialog);i.default(this._dialog).one(l.TRANSITION_END,a).emulateTransitionEnd(s)}else a()},e._enforceFocus=function(){var t=this;i.default(document).off("focusin.bs.modal").on("focusin.bs.modal",(function(e){document!==e.target&&t._element!==e.target&&0===i.default(t._element).has(e.target).length&&t._element.focus()}))},e._setEscapeEvent=function(){var t=this;this._isShown?i.default(this._element).on("keydown.dismiss.bs.modal",(function(e){t._config.keyboard&&27===e.which?(e.preventDefault(),t.hide()):t._config.keyboard||27!==e.which||t._triggerBackdropTransition()})):this._isShown||i.default(this._element).off("keydown.dismiss.bs.modal")},e._setResizeEvent=function(){var t=this;this._isShown?i.default(window).on("resize.bs.modal",(function(e){return t.handleUpdate(e)})):i.default(window).off("resize.bs.modal")},e._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((function(){i.default(document.body).removeClass("modal-open"),t._resetAdjustments(),t._resetScrollbar(),i.default(t._element).trigger("hidden.bs.modal")}))},e._removeBackdrop=function(){this._backdrop&&(i.default(this._backdrop).remove(),this._backdrop=null)},e._showBackdrop=function(t){var e=this,n=i.default(this._element).hasClass("fade")?"fade":"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",n&&this._backdrop.classList.add(n),i.default(this._backdrop).appendTo(document.body),i.default(this._element).on("click.dismiss.bs.modal",(function(t){e._ignoreBackdropClick?e._ignoreBackdropClick=!1:t.target===t.currentTarget&&e._triggerBackdropTransition()})),n&&l.reflow(this._backdrop),i.default(this._backdrop).addClass("show"),!t)return;if(!n)return void t();var o=l.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(l.TRANSITION_END,t).emulateTransitionEnd(o)}else if(!this._isShown&&this._backdrop){i.default(this._backdrop).removeClass("show");var r=function(){e._removeBackdrop(),t&&t()};if(i.default(this._element).hasClass("fade")){var a=l.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(l.TRANSITION_END,r).emulateTransitionEnd(a)}else r()}else t&&t()},e._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Qt,popperConfig:null},Zt={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},te=function(){function t(t,e){if("undefined"==typeof It)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var e=t.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=i.default(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(i.default(this.getTipElement()).hasClass("show"))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),i.default.removeData(this.element,this.constructor.DATA_KEY),i.default(this.element).off(this.constructor.EVENT_KEY),i.default(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&i.default(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===i.default(this.element).css("display"))throw new Error("Please use show on visible elements");var e=i.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){i.default(this.element).trigger(e);var n=l.findShadowRoot(this.element),o=i.default.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!o)return;var r=this.getTipElement(),a=l.getUID(this.constructor.NAME);r.setAttribute("id",a),this.element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&i.default(r).addClass("fade");var s="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,u=this._getAttachment(s);this.addAttachmentClass(u);var f=this._getContainer();i.default(r).data(this.constructor.DATA_KEY,this),i.default.contains(this.element.ownerDocument.documentElement,this.tip)||i.default(r).appendTo(f),i.default(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new It(this.element,r,this._getPopperConfig(u)),i.default(r).addClass("show"),"ontouchstart"in document.documentElement&&i.default(document.body).children().on("mouseover",null,i.default.noop);var d=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,i.default(t.element).trigger(t.constructor.Event.SHOWN),"out"===e&&t._leave(null,t)};if(i.default(this.tip).hasClass("fade")){var c=l.getTransitionDurationFromElement(this.tip);i.default(this.tip).one(l.TRANSITION_END,d).emulateTransitionEnd(c)}else d()}},e.hide=function(t){var e=this,n=this.getTipElement(),o=i.default.Event(this.constructor.Event.HIDE),r=function(){"show"!==e._hoverState&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),i.default(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(i.default(this.element).trigger(o),!o.isDefaultPrevented()){if(i.default(n).removeClass("show"),"ontouchstart"in document.documentElement&&i.default(document.body).children().off("mouseover",null,i.default.noop),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,i.default(this.tip).hasClass("fade")){var a=l.getTransitionDurationFromElement(n);i.default(n).one(l.TRANSITION_END,r).emulateTransitionEnd(a)}else r();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-tooltip-"+t)},e.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},e.setContent=function(){var t=this.getTipElement();this.setElementContent(i.default(t.querySelectorAll(".tooltip-inner")),this.getTitle()),i.default(t).removeClass("fade show")},e.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=Vt(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?i.default(e).parent().is(t)||t.empty().append(e):t.text(i.default(e).text())},e.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},e._getPopperConfig=function(t){var e=this;return a({},{placement:t,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}},this.config.popperConfig)},e._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},e._getContainer=function(){return!1===this.config.container?document.body:l.isElement(this.config.container)?i.default(this.config.container):i.default(document).find(this.config.container)},e._getAttachment=function(t){return $t[t.toUpperCase()]},e._setListeners=function(){var t=this;this.config.trigger.split(" ").forEach((function(e){if("click"===e)i.default(t.element).on(t.constructor.Event.CLICK,t.config.selector,(function(e){return t.toggle(e)}));else if("manual"!==e){var n="hover"===e?t.constructor.Event.MOUSEENTER:t.constructor.Event.FOCUSIN,o="hover"===e?t.constructor.Event.MOUSELEAVE:t.constructor.Event.FOCUSOUT;i.default(t.element).on(n,t.config.selector,(function(e){return t._enter(e)})).on(o,t.config.selector,(function(e){return t._leave(e)}))}})),this._hideModalHandler=function(){t.element&&t.hide()},i.default(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=a({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?"focus":"hover"]=!0),i.default(e.getTipElement()).hasClass("show")||"show"===e._hoverState?e._hoverState="show":(clearTimeout(e._timeout),e._hoverState="show",e.config.delay&&e.config.delay.show?e._timeout=setTimeout((function(){"show"===e._hoverState&&e.show()}),e.config.delay.show):e.show())},e._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?"focus":"hover"]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState="out",e.config.delay&&e.config.delay.hide?e._timeout=setTimeout((function(){"out"===e._hoverState&&e.hide()}),e.config.delay.hide):e.hide())},e._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},e._getConfig=function(t){var e=i.default(this.element).data();return Object.keys(e).forEach((function(t){-1!==Kt.indexOf(t)&&delete e[t]})),"number"==typeof(t=a({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),l.typeCheckConfig(Yt,t,this.constructor.DefaultType),t.sanitize&&(t.template=Vt(t.template,t.whiteList,t.sanitizeFn)),t},e._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},e._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(Xt);null!==e&&e.length&&t.removeClass(e.join(""))},e._handlePopperPlacementChange=function(t){this.tip=t.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},e._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(i.default(t).removeClass("fade"),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.tooltip"),r="object"==typeof e&&e;if((o||!/dispose|hide/.test(e))&&(o||(o=new t(this,r),n.data("bs.tooltip",o)),"string"==typeof e)){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}},{key:"Default",get:function(){return Jt}},{key:"NAME",get:function(){return Yt}},{key:"DATA_KEY",get:function(){return"bs.tooltip"}},{key:"Event",get:function(){return Zt}},{key:"EVENT_KEY",get:function(){return".bs.tooltip"}},{key:"DefaultType",get:function(){return Gt}}]),t}();i.default.fn[Yt]=te._jQueryInterface,i.default.fn[Yt].Constructor=te,i.default.fn[Yt].noConflict=function(){return i.default.fn[Yt]=zt,te._jQueryInterface};var ee="popover",ne=i.default.fn[ee],ie=new RegExp("(^|\\s)bs-popover\\S+","g"),oe=a({},te.Default,{placement:"right",trigger:"click",content:"",template:''}),re=a({},te.DefaultType,{content:"(string|element|function)"}),ae={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"},se=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var a=o.prototype;return a.isWithContent=function(){return this.getTitle()||this._getContent()},a.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-popover-"+t)},a.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},a.setContent=function(){var t=i.default(this.getTipElement());this.setElementContent(t.find(".popover-header"),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(".popover-body"),e),t.removeClass("fade show")},a._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},a._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(ie);null!==e&&e.length>0&&t.removeClass(e.join(""))},o._jQueryInterface=function(t){return this.each((function(){var e=i.default(this).data("bs.popover"),n="object"==typeof t?t:null;if((e||!/dispose|hide/.test(t))&&(e||(e=new o(this,n),i.default(this).data("bs.popover",e)),"string"==typeof t)){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}}))},r(o,null,[{key:"VERSION",get:function(){return"4.5.3"}},{key:"Default",get:function(){return oe}},{key:"NAME",get:function(){return ee}},{key:"DATA_KEY",get:function(){return"bs.popover"}},{key:"Event",get:function(){return ae}},{key:"EVENT_KEY",get:function(){return".bs.popover"}},{key:"DefaultType",get:function(){return re}}]),o}(te);i.default.fn[ee]=se._jQueryInterface,i.default.fn[ee].Constructor=se,i.default.fn[ee].noConflict=function(){return i.default.fn[ee]=ne,se._jQueryInterface};var le="scrollspy",ue=i.default.fn[le],fe={offset:10,method:"auto",target:""},de={offset:"number",method:"string",target:"(string|element)"},ce=function(){function t(t,e){var n=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(e),this._selector=this._config.target+" .nav-link,"+this._config.target+" .list-group-item,"+this._config.target+" .dropdown-item",this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,i.default(this._scrollElement).on("scroll.bs.scrollspy",(function(t){return n._process(t)})),this.refresh(),this._process()}var e=t.prototype;return e.refresh=function(){var t=this,e=this._scrollElement===this._scrollElement.window?"offset":"position",n="auto"===this._config.method?e:this._config.method,o="position"===n?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map((function(t){var e,r=l.getSelectorFromElement(t);if(r&&(e=document.querySelector(r)),e){var a=e.getBoundingClientRect();if(a.width||a.height)return[i.default(e)[n]().top+o,r]}return null})).filter((function(t){return t})).sort((function(t,e){return t[0]-e[0]})).forEach((function(e){t._offsets.push(e[0]),t._targets.push(e[1])}))},e.dispose=function(){i.default.removeData(this._element,"bs.scrollspy"),i.default(this._scrollElement).off(".bs.scrollspy"),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},e._getConfig=function(t){if("string"!=typeof(t=a({},fe,"object"==typeof t&&t?t:{})).target&&l.isElement(t.target)){var e=i.default(t.target).attr("id");e||(e=l.getUID(le),i.default(t.target).attr("id",e)),t.target="#"+e}return l.typeCheckConfig(le,t,de),t},e._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},e._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},e._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},e._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&t>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t li > .active":".active";n=(n=i.default.makeArray(i.default(o).find(a)))[n.length-1]}var s=i.default.Event("hide.bs.tab",{relatedTarget:this._element}),u=i.default.Event("show.bs.tab",{relatedTarget:n});if(n&&i.default(n).trigger(s),i.default(this._element).trigger(u),!u.isDefaultPrevented()&&!s.isDefaultPrevented()){r&&(e=document.querySelector(r)),this._activate(this._element,o);var f=function(){var e=i.default.Event("hidden.bs.tab",{relatedTarget:t._element}),o=i.default.Event("shown.bs.tab",{relatedTarget:n});i.default(n).trigger(e),i.default(t._element).trigger(o)};e?this._activate(e,e.parentNode,f):f()}}},e.dispose=function(){i.default.removeData(this._element,"bs.tab"),this._element=null},e._activate=function(t,e,n){var o=this,r=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?i.default(e).children(".active"):i.default(e).find("> li > .active"))[0],a=n&&r&&i.default(r).hasClass("fade"),s=function(){return o._transitionComplete(t,r,n)};if(r&&a){var u=l.getTransitionDurationFromElement(r);i.default(r).removeClass("show").one(l.TRANSITION_END,s).emulateTransitionEnd(u)}else s()},e._transitionComplete=function(t,e,n){if(e){i.default(e).removeClass("active");var o=i.default(e.parentNode).find("> .dropdown-menu .active")[0];o&&i.default(o).removeClass("active"),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}if(i.default(t).addClass("active"),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),l.reflow(t),t.classList.contains("fade")&&t.classList.add("show"),t.parentNode&&i.default(t.parentNode).hasClass("dropdown-menu")){var r=i.default(t).closest(".dropdown")[0];if(r){var a=[].slice.call(r.querySelectorAll(".dropdown-toggle"));i.default(a).addClass("active")}t.setAttribute("aria-expanded",!0)}n&&n()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.tab");if(o||(o=new t(this),n.data("bs.tab",o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}}]),t}();i.default(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',(function(t){t.preventDefault(),pe._jQueryInterface.call(i.default(this),"show")})),i.default.fn.tab=pe._jQueryInterface,i.default.fn.tab.Constructor=pe,i.default.fn.tab.noConflict=function(){return i.default.fn.tab=he,pe._jQueryInterface};var me=i.default.fn.toast,ge={animation:"boolean",autohide:"boolean",delay:"number"},ve={animation:!0,autohide:!0,delay:500},_e=function(){function t(t,e){this._element=t,this._config=this._getConfig(e),this._timeout=null,this._setListeners()}var e=t.prototype;return e.show=function(){var t=this,e=i.default.Event("show.bs.toast");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");var n=function(){t._element.classList.remove("showing"),t._element.classList.add("show"),i.default(t._element).trigger("shown.bs.toast"),t._config.autohide&&(t._timeout=setTimeout((function(){t.hide()}),t._config.delay))};if(this._element.classList.remove("hide"),l.reflow(this._element),this._element.classList.add("showing"),this._config.animation){var o=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,n).emulateTransitionEnd(o)}else n()}},e.hide=function(){if(this._element.classList.contains("show")){var t=i.default.Event("hide.bs.toast");i.default(this._element).trigger(t),t.isDefaultPrevented()||this._close()}},e.dispose=function(){this._clearTimeout(),this._element.classList.contains("show")&&this._element.classList.remove("show"),i.default(this._element).off("click.dismiss.bs.toast"),i.default.removeData(this._element,"bs.toast"),this._element=null,this._config=null},e._getConfig=function(t){return t=a({},ve,i.default(this._element).data(),"object"==typeof t&&t?t:{}),l.typeCheckConfig("toast",t,this.constructor.DefaultType),t},e._setListeners=function(){var t=this;i.default(this._element).on("click.dismiss.bs.toast",'[data-dismiss="toast"]',(function(){return t.hide()}))},e._close=function(){var t=this,e=function(){t._element.classList.add("hide"),i.default(t._element).trigger("hidden.bs.toast")};if(this._element.classList.remove("show"),this._config.animation){var n=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},e._clearTimeout=function(){clearTimeout(this._timeout),this._timeout=null},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.toast");if(o||(o=new t(this,"object"==typeof e&&e),n.data("bs.toast",o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e](this)}}))},r(t,null,[{key:"VERSION",get:function(){return"4.5.3"}},{key:"DefaultType",get:function(){return ge}},{key:"Default",get:function(){return ve}}]),t}();i.default.fn.toast=_e._jQueryInterface,i.default.fn.toast.Constructor=_e,i.default.fn.toast.noConflict=function(){return i.default.fn.toast=me,_e._jQueryInterface},t.Alert=d,t.Button=h,t.Carousel=y,t.Collapse=S,t.Dropdown=Ft,t.Modal=Bt,t.Popover=se,t.Scrollspy=ce,t.Tab=pe,t.Toast=_e,t.Tooltip=te,t.Util=l,Object.defineProperty(t,"__esModule",{value:!0})})); 7 | //# sourceMappingURL=bootstrap.bundle.min.js.map -------------------------------------------------------------------------------- /flaskstarter/static/jquery.slim.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v3.5.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector | (c) JS Foundation and other contributors | jquery.org/license */ 2 | !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(g,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,v=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),m={},b=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},w=g.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function C(e,t,n){var r,i,o=(n=n||w).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function T(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector",E=function(e,t){return new E.fn.init(e,t)};function d(e){var t=!!e&&"length"in e&&e.length,n=T(e);return!b(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+R+")"+R+"*"),U=new RegExp(R+"|>"),V=new RegExp(W),X=new RegExp("^"+B+"$"),Q={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),TAG:new RegExp("^("+B+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),bool:new RegExp("^(?:"+I+")$","i"),needsContext:new RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,G=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+R+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){C()},ae=xe(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{O.apply(t=P.call(d.childNodes),d.childNodes),t[d.childNodes.length].nodeType}catch(e){O={apply:t.length?function(e,t){q.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,d=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==d&&9!==d&&11!==d)return n;if(!r&&(C(e),e=e||T,E)){if(11!==d&&(u=Z.exec(t)))if(i=u[1]){if(9===d){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return O.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&p.getElementsByClassName&&e.getElementsByClassName)return O.apply(n,e.getElementsByClassName(i)),n}if(p.qsa&&!k[t+" "]&&(!v||!v.test(t))&&(1!==d||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===d&&(U.test(t)||_.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&p.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=A)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+be(l[o]);c=l.join(",")}try{return O.apply(n,f.querySelectorAll(c)),n}catch(e){k(t,!0)}finally{s===A&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>x.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[A]=!0,e}function ce(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)x.attrHandle[n[r]]=t}function de(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pe(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in p=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},C=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:d;return r!=T&&9===r.nodeType&&r.documentElement&&(a=(T=r).documentElement,E=!i(T),d!=T&&(n=T.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),p.scope=ce(function(e){return a.appendChild(e).appendChild(T.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),p.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=ce(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=J.test(T.getElementsByClassName),p.getById=ce(function(e){return a.appendChild(e).id=A,!T.getElementsByName||!T.getElementsByName(A).length}),p.getById?(x.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},x.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(x.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},x.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),x.find.TAG=p.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):p.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},x.find.CLASS=p.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(p.qsa=J.test(T.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+R+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+R+"*(?:value|"+I+")"),e.querySelectorAll("[id~="+A+"-]").length||v.push("~="),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+R+"*name"+R+"*="+R+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+A+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+R+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(p.matchesSelector=J.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){p.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",W)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(a.compareDocumentPosition),y=t||J.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===n?e==T||e.ownerDocument==d&&y(d,e)?-1:t==T||t.ownerDocument==d&&y(d,t)?1:u?H(u,e)-H(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==T?-1:t==T?1:i?-1:o?1:u?H(u,e)-H(u,t):0;if(i===o)return de(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?de(a[r],s[r]):a[r]==d?-1:s[r]==d?1:0}),T},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(C(e),p.matchesSelector&&E&&!k[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||p.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){k(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&V.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+R+")"+e+"("+R+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return b(n)?E.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?E.grep(e,function(e){return e===n!==r}):"string"!=typeof n?E.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(E.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||L,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:j.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:w,!0)),k.test(r[1])&&E.isPlainObject(t))for(r in t)b(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=w.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):b(e)?void 0!==n.ready?n.ready(e):e(E):E.makeArray(e,this)}).prototype=E.fn,L=E(w);var q=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}E.fn.extend({has:function(e){var t=E(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,pe=/^$|^module$|\/(?:java|ecma)script/i;le=w.createDocumentFragment().appendChild(w.createElement("div")),(ce=w.createElement("input")).setAttribute("type","radio"),ce.setAttribute("checked","checked"),ce.setAttribute("name","t"),le.appendChild(ce),m.checkClone=le.cloneNode(!0).cloneNode(!0).lastChild.checked,le.innerHTML="",m.noCloneChecked=!!le.cloneNode(!0).lastChild.defaultValue,le.innerHTML="",m.option=!!le.lastChild;var he={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ge(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&S(e,t)?E.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var ye=/<|&#?\w+;/;function me(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),d=[],p=0,h=e.length;p\s*$/g;function Le(e,t){return S(e,"table")&&S(11!==t.nodeType?t:t.firstChild,"tr")&&E(e).children("tbody")[0]||e}function je(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n
",2===ft.childNodes.length),E.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(m.createHTMLDocument?((r=(t=w.implementation.createHTMLDocument("")).createElement("base")).href=w.location.href,t.head.appendChild(r)):t=w),o=!n&&[],(i=k.exec(e))?[t.createElement(i[1])]:(i=me([e],t,o),o&&o.length&&E(o).remove(),E.merge([],i.childNodes)));var r,i,o},E.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=E.css(e,"position"),c=E(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=E.css(e,"top"),u=E.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),b(t)&&(t=t.call(e,n,E.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},E.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){E.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===E.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===E.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=E(e).offset()).top+=E.css(e,"borderTopWidth",!0),i.left+=E.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-E.css(r,"marginTop",!0),left:t.left-i.left-E.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===E.css(e,"position"))e=e.offsetParent;return e||re})}}),E.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;E.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),E.each(["top","left"],function(e,n){E.cssHooks[n]=Fe(m.pixelPosition,function(e,t){if(t)return t=We(e,n),Ie.test(t)?E(e).position()[n]+"px":t})}),E.each({Height:"height",Width:"width"},function(a,s){E.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){E.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?E.css(e,t,i):E.style(e,t,n,i)},s,n?e:void 0,n)}})}),E.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),E.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){E.fn[n]=function(e,t){return 0', methods=['GET', 'POST']) 27 | @login_required 28 | def view_task(id): 29 | _task = MyTaskModel.query.filter_by(id=id, users_id=current_user.id).first() 30 | 31 | if not _task: 32 | flash('Oops! Something went wrong!.', 'danger') 33 | return redirect(url_for("tasks.my_tasks")) 34 | 35 | return render_template('tasks/view_task.html', 36 | task=_task) 37 | 38 | 39 | @tasks.route('/add_task', methods=['GET', 'POST']) 40 | @login_required 41 | def add_task(): 42 | 43 | _task = MyTaskModel() 44 | 45 | _form = MyTaskForm() 46 | 47 | if _form.validate_on_submit(): 48 | 49 | _task.users_id = current_user.id 50 | 51 | _form.populate_obj(_task) 52 | 53 | db.session.add(_task) 54 | db.session.commit() 55 | 56 | db.session.refresh(_task) 57 | flash('Your task is added successfully!', 'success') 58 | return redirect(url_for("tasks.my_tasks")) 59 | 60 | return render_template('tasks/add_task.html', form=_form, _active_tasks=True) 61 | 62 | 63 | @tasks.route('/delete_task/', methods=['GET', 'POST']) 64 | @login_required 65 | def delete_task(id): 66 | _task = MyTaskModel.query.filter_by(id=id, users_id=current_user.id).first() 67 | 68 | if not _task: 69 | flash('Oops! Something went wrong!.', 'danger') 70 | return redirect(url_for("tasks.my_tasks")) 71 | 72 | db.session.delete(_task) 73 | db.session.commit() 74 | 75 | flash('Your task is deleted successfully!', 'success') 76 | return redirect(url_for('tasks.my_tasks')) 77 | 78 | 79 | @tasks.route('/edit_task/', methods=['GET', 'POST']) 80 | @login_required 81 | def edit_task(id): 82 | _task = MyTaskModel.query.filter_by(id=id, users_id=current_user.id).first() 83 | 84 | if not _task: 85 | flash('Oops! Something went wrong!.', 'danger') 86 | return redirect(url_for("tasks.my_tasks")) 87 | 88 | _form = MyTaskForm(obj=_task) 89 | 90 | if _form.validate_on_submit(): 91 | 92 | _task.users_id = current_user.id 93 | _form.populate_obj(_task) 94 | 95 | db.session.add(_task) 96 | db.session.commit() 97 | 98 | flash('Your task updated successfully!', 'success') 99 | return redirect(url_for("tasks.my_tasks")) 100 | 101 | return render_template('tasks/edit_task.html', form=_form, task=_task, _active_tasks=True) 102 | -------------------------------------------------------------------------------- /flaskstarter/templates/admin/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'admin/master.html' %} 2 | 3 | {% block body %} 4 |

Hello, Welcome to Flask-Starter's Admin Dashboard

5 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/dashboard/dashboard.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Dashboard' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('tasks.add_task'), task_form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/change_password.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Change Password' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('frontend.change_password'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/contact_us.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Contact Us' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('frontend.contact_us'), form)}} 12 |
13 |
14 |
15 | {% endblock %}c -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/landing.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Flask-Starter Template for Python Flask Applications' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 |

Welcome, build something great!

12 |

Let's start with Python & Flask

13 |
14 |
15 |
16 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/login.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Login' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('frontend.login'), form)}} 12 | Forgot Password? 13 |
14 |
15 |
16 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/reset_password.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Reset Password' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('frontend.reset_password'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/frontend/signup.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Sign Up' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('frontend.signup'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/layouts/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {% block title %}{{ page_title|default('Flask-Starter') }}{% endblock %} - Flask-Starter-App 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | {% include 'macros/_flash_msg.html' %} 31 | 32 | {% block body %} 33 | 34 | {% endblock %} 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /flaskstarter/templates/layouts/header.html: -------------------------------------------------------------------------------- 1 | {% if current_user.is_authenticated %} 2 | 28 | 29 | {% else %} 30 | 43 | {% endif %} -------------------------------------------------------------------------------- /flaskstarter/templates/macros/_confirm_account.html: -------------------------------------------------------------------------------- 1 |

You have created an account on {{ project }}.

2 | 3 |

To activate your account, click on the link below (or copy and paste the URL into your browser):

4 | 5 | Click to Activate 6 | 7 |

Best Wishes,

8 |

{{ project }} Team

9 | -------------------------------------------------------------------------------- /flaskstarter/templates/macros/_flash_msg.html: -------------------------------------------------------------------------------- 1 | {% with messages = get_flashed_messages(with_categories=true) %} 2 | {% if messages %} 3 | {% for category, message in messages %} 4 | 7 | {% endfor %} 8 | {% endif %} 9 | {% endwith %} -------------------------------------------------------------------------------- /flaskstarter/templates/macros/_form.html: -------------------------------------------------------------------------------- 1 | {% macro render_checkbox(field) %} 2 |
3 | 6 | {{ field.description }} 7 | {% if field.errors -%} 8 |
    9 | {% for error in field.errors -%} 10 |
  • {{ error|e }}
  • 11 | {%- endfor %} 12 |
13 | {%- endif %} 14 |
15 | {% endmacro%} 16 | 17 | {% macro render_radio(field) %} 18 |
19 | {{ field.label(class_="control-label") }} 20 |
21 | {% for subfield in field -%} 22 | 25 | {%- endfor %} 26 | {{ field.description }} 27 | {% if field.errors -%} 28 |
    29 | {% for error in field.errors -%} 30 |
  • {{ error }}
  • 31 | {%- endfor %} 32 |
33 | {%- endif %} 34 |
35 |
36 | {% endmacro %} 37 | 38 | {% macro render_datepicker(field) %} 39 |
40 | 44 |
45 | {{ field() }} 46 | {{ field.description }} 47 | {% if field.errors -%} 48 |
    49 | {% for error in field.errors -%} 50 |
  • {{ error }}
  • 51 | {%- endfor %} 52 |
53 | {%- endif %} 54 |
55 |
56 | {% endmacro %} 57 | 58 | {% macro render_textarea(field) %} 59 |
60 | 64 |
65 | {{ field(class_="form-control", rows="4") }} 66 | {{ field.description }} 67 | {% if field.errors -%} 68 |
    69 | {% for error in field.errors -%} 70 |
  • {{ error }}
  • 71 | {%- endfor %} 72 |
73 | {%- endif %} 74 |
75 |
76 | {% endmacro %} 77 | 78 | {% macro render_file(field) %} 79 |
80 | 84 |
85 | {{ field }} 86 | {{ field.description }} 87 | {% if field.errors -%} 88 |
    89 | {% for error in field.errors -%} 90 |
  • {{ error }}
  • 91 | {%- endfor %} 92 |
93 | {%- endif %} 94 |
95 |
96 | {% endmacro %} 97 | 98 | {% macro render_input(field) %} 99 |
100 | 101 | {{ field(class_="form-control") }} 102 | {{ field.description }} 103 | 104 | {% if field.errors -%} 105 |
    106 | {% for error in field.errors %} 107 |
    108 | {% endfor %} 109 |
110 | {% endif %} 111 |
112 | {% endmacro %} 113 | 114 | {% macro render_action(field) %} 115 |
116 |
117 | {{ field(class_="btn btn-primary") }} 118 |
119 |
120 | {% endmacro %} 121 | 122 | {% macro render_form(url, form, horizontal=False, legend=None, confirm_msg=None, formid=None) %} 123 | {% set idattr = "id=" + formid if formid else "" %} 124 |
127 | {{ form.hidden_tag() }} 128 | {% if legend %} 129 | {{ legend|safe }} 130 | {% endif %} 131 | {% set focus = True %} 132 | {% for field in form %} 133 | {% if field.type != "HiddenField" and field.type != "CSRFTokenField" %} 134 | {% if field.type == "RadioField" %} 135 | {{ render_radio(field) }} 136 | {% elif field.type == "BooleanField" %} 137 | {{ render_checkbox(field) }} 138 | {% elif field.type == "SubmitField" %} 139 | {{ render_action(field) }} 140 | {% elif field.type == "TextAreaField" %} 141 | {{ render_textarea(field) }} 142 | {% elif field.type == "DateField" %} 143 | {{ render_datepicker(field) }} 144 | {% elif field.type == "FileField" %} 145 | {{ render_file(field) }} 146 | {% elif field.type == "TextField" %} 147 | {% if focus %} 148 | {{ render_input(field) }} 149 | {% set focus = False %} 150 | {% else %} 151 | {{ render_input(field) }} 152 | {% endif %} 153 | {% else %} 154 | {{ render_input(field) }} 155 | {% endif %} 156 | {% endif %} 157 | {% endfor %} 158 |
159 | {% endmacro %} 160 | -------------------------------------------------------------------------------- /flaskstarter/templates/macros/_reset_password.html: -------------------------------------------------------------------------------- 1 |

Forgot your password, {{ name }}?

2 | 3 |

{{ project }} received a request to reset the password for your {{ project }} account {{ name }}.

4 | 5 |

If you want to reset your password, click on the link below (or copy and paste the URL into your browser):

6 | 7 | Click to Reset Password 8 | 9 |

This link takes you to a secure page where you can change your password.

10 | 11 |

If you don't want to reset your password, please ignore this message. Your password will not be reset. If you have any concerns, please contact us at {{ project }} Support.

12 | 13 |

Best Wishes,

14 |

{{ project }} Team

15 | -------------------------------------------------------------------------------- /flaskstarter/templates/settings/password.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Update Password' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('settings.password'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/settings/profile.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Update Profile' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('settings.profile'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/tasks/add_task.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Add Task' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('tasks.add_task'), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/tasks/edit_task.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'Edit Task' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | {{ render_form(url_for('tasks.edit_task', id=task.id), form)}} 12 |
13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/tasks/my_tasks.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'My Tasks' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% if all_tasks|length > 0 %} 20 | {% for task in all_tasks %} 21 | 22 | 23 | 30 | 31 | {% endfor %} 32 | {% else %} 33 | 34 | 35 | 36 | {% endif %} 37 | 38 |
My TasksActions
{{ task.task }} 24 |
25 | View 26 | Edit 27 | Delete 28 |
29 |
No Task Added. Please add a task
39 |
40 |
41 |
42 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/templates/tasks/view_task.html: -------------------------------------------------------------------------------- 1 | {% from "macros/_form.html" import render_form %} 2 | 3 | {% set page_title = 'View Task' %} 4 | 5 | {% extends 'layouts/base.html' %} 6 | 7 | {% block body %} 8 |
9 |
10 |
11 |
12 |
13 |

{{ task.task }}

14 |
15 | {{ task.added_time | _pretty_date }} 16 |
17 |
18 |
19 |
20 |
21 |
22 | {% endblock %} -------------------------------------------------------------------------------- /flaskstarter/user/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .models import Users, UsersAdmin 4 | from .constants import USER_ROLE, ADMIN, USER, USER_STATUS, NEW, ACTIVE 5 | -------------------------------------------------------------------------------- /flaskstarter/user/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # User role 4 | ADMIN = 0 5 | STAFF = 1 6 | USER = 2 7 | USER_ROLE = { 8 | ADMIN: 'admin', 9 | STAFF: 'staff', 10 | USER: 'user', 11 | } 12 | 13 | # User status 14 | INACTIVE = 0 15 | NEW = 1 16 | ACTIVE = 2 17 | USER_STATUS = { 18 | INACTIVE: 'inactive', 19 | NEW: 'new', 20 | ACTIVE: 'active', 21 | } 22 | 23 | 24 | # Account Type 25 | BASIC = 0 26 | PRO = 1 27 | PREMIUM = 2 28 | ACCOUNT_TYPE = { 29 | BASIC: 'basic', 30 | PRO: 'pro', 31 | PREMIUM: 'premium' 32 | } 33 | -------------------------------------------------------------------------------- /flaskstarter/user/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from sqlalchemy import Column, types 4 | from sqlalchemy.ext.mutable import Mutable 5 | from werkzeug.security import generate_password_hash, check_password_hash 6 | from flask_login import UserMixin 7 | 8 | from ..extensions import db 9 | from ..utils import get_current_time, STRING_LEN 10 | from .constants import USER, USER_ROLE, ADMIN, INACTIVE, USER_STATUS 11 | 12 | from flask_login import current_user 13 | from flask_admin.contrib import sqla 14 | 15 | 16 | class DenormalizedText(Mutable, types.TypeDecorator): 17 | """ 18 | Stores denormalized primary keys that can be 19 | accessed as a set. 20 | 21 | :param coerce: coercion function that ensures correct 22 | type is returned 23 | 24 | :param separator: separator character 25 | """ 26 | 27 | impl = types.Text 28 | 29 | def __init__(self, coerce=int, separator=" ", **kwargs): 30 | 31 | self.coerce = coerce 32 | self.separator = separator 33 | 34 | super(DenormalizedText, self).__init__(**kwargs) 35 | 36 | def process_bind_param(self, value, dialect): 37 | if value is not None: 38 | items = [str(item).strip() for item in value] 39 | value = self.separator.join(item for item in items if item) 40 | return value 41 | 42 | def process_result_value(self, value, dialect): 43 | if not value: 44 | return set() 45 | return set(self.coerce(item) for item in value.split(self.separator)) 46 | 47 | def copy_value(self, value): 48 | return set(value) 49 | 50 | 51 | class Users(db.Model, UserMixin): 52 | 53 | __tablename__ = 'users' 54 | 55 | id = Column(db.Integer, primary_key=True) 56 | 57 | name = Column(db.String(STRING_LEN)) 58 | 59 | email = Column(db.String(STRING_LEN), unique=True) 60 | email_activation_key = Column(db.String(STRING_LEN)) 61 | 62 | created_time = Column(db.DateTime, default=get_current_time) 63 | 64 | _password = Column('password', db.String(128), nullable=False) 65 | 66 | def _get_password(self): 67 | return self._password 68 | 69 | def _set_password(self, password): 70 | self._password = generate_password_hash(password) 71 | 72 | # Hide password encryption by exposing password field only. 73 | password = db.synonym('_password', 74 | descriptor=property(_get_password, 75 | _set_password)) 76 | 77 | def check_password(self, password): 78 | if self.password is None: 79 | return False 80 | return check_password_hash(self.password, password) 81 | 82 | role_code = Column(db.SmallInteger, default=USER, nullable=False) 83 | 84 | @property 85 | def role(self): 86 | return USER_ROLE[self.role_code] 87 | 88 | def is_admin(self): 89 | return self.role_code == ADMIN 90 | 91 | def is_authenticated(self): 92 | return True 93 | 94 | # One-to-many relationship between users and user_statuses. 95 | status_code = Column(db.SmallInteger, default=INACTIVE) 96 | 97 | @property 98 | def status(self): 99 | return USER_STATUS[self.status_code] 100 | 101 | # Class methods 102 | 103 | @classmethod 104 | def authenticate(cls, login, password): 105 | user = cls.query.filter(Users.email.ilike(login)).first() 106 | 107 | if user: 108 | authenticated = user.check_password(password) 109 | else: 110 | authenticated = False 111 | 112 | return user, authenticated 113 | 114 | @classmethod 115 | def get_by_id(cls, user_id): 116 | return cls.query.filter_by(id=user_id).first_or_404() 117 | 118 | def check_email(self, email): 119 | return Users.query.filter(Users.email == email).count() == 0 120 | 121 | def __unicode__(self): 122 | _str = '%s. %s' % (self.id, self.name) 123 | return str(_str) 124 | 125 | 126 | # Customized User model admin 127 | class UsersAdmin(sqla.ModelView): 128 | column_list = ('id', 'name', 'email', 'role_code', 'status_code', 129 | 'created_time', 'activation_key') 130 | column_sortable_list = ('id', 'name', 'email', 'created_time', 131 | 'role_code', 'status_code') 132 | column_searchable_list = ('email', Users.email) 133 | column_filters = ('id', 'name', 'email', 'created_time', 'role_code') 134 | 135 | form_excluded_columns = ('password') 136 | 137 | form_choices = { 138 | 'role_code': [ 139 | ('2', 'User'), 140 | ('0', 'Admin') 141 | ], 142 | 'status_code': [ 143 | ('0', 'Inactive Account'), 144 | ('1', 'New Account'), 145 | ('2', 'Active Account') 146 | ] 147 | } 148 | 149 | column_choices = { 150 | 'role_code': [ 151 | (2, 'User'), 152 | (1, 'Staff'), 153 | (0, 'Admin') 154 | ], 155 | 'status_code': [ 156 | (0, 'Inactive Account'), 157 | (1, 'New Account'), 158 | (2, 'Active Account') 159 | ] 160 | } 161 | 162 | def __init__(self, session): 163 | super(UsersAdmin, self).__init__(Users, session) 164 | 165 | def is_accessible(self): 166 | if current_user.role == 'admin': 167 | return current_user.is_authenticated() 168 | -------------------------------------------------------------------------------- /flaskstarter/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Common utilities to be used in application 4 | """ 5 | 6 | import os 7 | 8 | import datetime 9 | 10 | 11 | # Instance folder path, to keep stuff aware from flask app. 12 | INSTANCE_FOLDER_PATH = os.path.join('/tmp', 'flaskstarter-instance') 13 | 14 | 15 | # Form validation 16 | 17 | NAME_LEN_MIN = 4 18 | NAME_LEN_MAX = 25 19 | 20 | PASSWORD_LEN_MIN = 6 21 | PASSWORD_LEN_MAX = 16 22 | 23 | 24 | # Model 25 | STRING_LEN = 64 26 | 27 | 28 | def get_current_time(): 29 | return datetime.datetime.utcnow() 30 | 31 | 32 | def pretty_date(dt, default=None): 33 | # Returns string representing "time since" eg 3 days ago, 5 hours ago etc. 34 | 35 | if default is None: 36 | default = 'just now' 37 | 38 | now = datetime.datetime.utcnow() 39 | diff = now - dt 40 | 41 | periods = ( 42 | (diff.days / 365, 'year', 'years'), 43 | (diff.days / 30, 'month', 'months'), 44 | (diff.days / 7, 'week', 'weeks'), 45 | (diff.days, 'day', 'days'), 46 | (diff.seconds / 3600, 'hour', 'hours'), 47 | (diff.seconds / 60, 'minute', 'minutes'), 48 | (diff.seconds, 'second', 'seconds'), 49 | ) 50 | 51 | for period, singular, plural in periods: 52 | 53 | if not period: 54 | continue 55 | 56 | if int(period) >= 1: 57 | if int(period) > 1: 58 | return u'%d %s ago' % (period, plural) 59 | return u'%d %s ago' % (period, singular) 60 | 61 | return default 62 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from sqlalchemy.orm.mapper import configure_mappers 4 | 5 | from flaskstarter import create_app 6 | from flaskstarter.extensions import db 7 | from flaskstarter.user import Users, ADMIN, USER, ACTIVE 8 | from flaskstarter.tasks import MyTaskModel 9 | 10 | application = create_app() 11 | 12 | 13 | @application.cli.command("initdb") 14 | def initdb(): 15 | """Init/reset database.""" 16 | 17 | db.drop_all() 18 | configure_mappers() 19 | db.create_all() 20 | 21 | admin = Users(name='Admin Flask-Starter', 22 | email=u'admin@your-mail.com', 23 | password=u'adminpassword', 24 | role_code=ADMIN, 25 | status_code=ACTIVE) 26 | 27 | db.session.add(admin) 28 | 29 | for i in range(1, 2): 30 | user = Users(name='Demo User', 31 | email=u'demo@your-mail.com', 32 | password=u'demopassword', 33 | role_code=USER, 34 | status_code=ACTIVE) 35 | db.session.add(user) 36 | 37 | for i in range(1, 5): 38 | _task = MyTaskModel(task="Task Random Number ## " + str(i), users_id=2) 39 | 40 | db.session.add(_task) 41 | 42 | db.session.commit() 43 | 44 | print("Database initialized with 2 users (admin, demo)") 45 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask[async]==2.0.2 2 | Flask-SQLAlchemy==2.5.1 3 | Flask-WTF==1.0.0 4 | Flask-Mail==0.9.1 5 | Flask-Caching==1.10.1 6 | Flask-Login==0.5.0 7 | Flask-Admin==1.6.0 8 | email-validator==1.1.3 9 | itsdangerous==2.0.1 10 | pytest==7.0.1 11 | Jinja2==3.0.3 12 | Werkzeug==2.0.0 -------------------------------------------------------------------------------- /screenshots/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/admin.png -------------------------------------------------------------------------------- /screenshots/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/dashboard.png -------------------------------------------------------------------------------- /screenshots/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/homepage.png -------------------------------------------------------------------------------- /screenshots/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/login.png -------------------------------------------------------------------------------- /screenshots/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/profile.png -------------------------------------------------------------------------------- /screenshots/signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/signup.png -------------------------------------------------------------------------------- /screenshots/tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/screenshots/tasks.png -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksh7/flask-starter/4b650bf98399531d6b4317fad475bab9532eced1/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_flaskstarter.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import pytest 4 | 5 | from flask_login import current_user 6 | from flaskstarter import create_app 7 | from flaskstarter.extensions import db 8 | from flaskstarter.user import Users, USER, ACTIVE 9 | 10 | @pytest.fixture 11 | def client(): 12 | app = create_app() 13 | 14 | app.config["TESTING"] = True 15 | app.testing = True 16 | 17 | client = app.test_client() 18 | yield client 19 | 20 | 21 | def test_home_page(client): 22 | response = client.get("/") 23 | assert b"Let\'s start with Python & Flask" in response.data 24 | --------------------------------------------------------------------------------