This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from peewee import Model, CharField, SqliteDatabase | |
from wtforms import validators | |
from wtfpeewee.orm import model_form | |
from flask import Flask, abort, request, flash, render_template | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
db = SqliteDatabase('test.sqlite', check_same_thread=False) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import os.path as op | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
from sqlalchemy.event import listens_for | |
from flask_admin import Admin, form | |
from flask_admin.contrib import sqla |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, url_for, redirect, request | |
from PIL import Image | |
app = Flask(__name__) | |
def allowed_file(filename): | |
return '.' in filename and \ | |
filename.rsplit('.', 1)[1] in ('gif', 'jpg', 'jpeg', 'png', 'tiff') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, session, request | |
from flask_sqlalchemy import SQLAlchemy | |
import flask_admin as admin | |
from flask_admin.contrib import sqla | |
from flask_admin import expose | |
# Create application | |
app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def csv_encode(value, encoding='UTF-8'): | |
if py3compat.PY3 or not isinstance(value, unicode): | |
return value | |
return value.encode(encoding, 'replace') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
import flask_admin as admin | |
from flask_admin.contrib import sqla | |
from sqlalchemy_utils import UUIDType | |
# Create application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flask_wtf | |
import flask_admin as admin | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_admin.contrib import sqla | |
# Create application | |
app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, redirect, url_for, request | |
import peewee | |
import flask_admin as admin | |
from flask_admin.contrib.peewee import ModelView | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
import flask_admin as admin | |
from flask_admin.contrib import sqla | |
# Create application | |
app = Flask(__name__) | |
# Create dummy secrey key so we can use sessions | |
app.config['SECRET_KEY'] = '123456790' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
from sqlalchemy import Column, ForeignKey, Integer, String | |
from sqlalchemy.orm import relationship | |
# Create application | |
app = Flask(__name__) | |
# Create dummy secrey key so we can use sessions |