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
{% extends 'parent.html' %} | |
{% block css %} | |
<link href = "{{ url_for('static', filename = 'base/child.css') }}" rel = "stylesheet"> | |
{% endblock css%} | |
{% block content %} | |
<form> | |
<input name="foo"/> | |
</form> |
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 price_logger(mapper, connection, target): | |
data = target.__dict__.copy() | |
print('Update event caught') | |
print("Current Value:", data["retail"]) # Current value (working as expected) | |
value = get_history(target, 'retail') | |
print(f'Old value was {value}, new is {data["retail"]}') | |
print('-'*10) | |
class History(db.Model): | |
id = db.Column(db.Integer, primary_key=True) |
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, request | |
from flask import json | |
from io import BytesIO | |
app = Flask(__name__) | |
app.config["MAX_CONTENT_LENGTH"] = 102400 | |
@app.route('/', methods=['post', 'get']) | |
def upload(): |
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 requests | |
@app.route('/form', methods=['GET', 'POST']) | |
def form(): | |
form = RebootForm() | |
ugly_messages = [] | |
if form.validate_on_submit(): | |
ip_addresses = form.available.data | |
for ip_address in ip_addresses: | |
requests.get('http://{}/rc.cgi?L=uirreboot.html&c=99'.format(ipaddress)) |
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, g, render_template | |
from flask.ext.login import LoginManager | |
import forms | |
import models | |
app = Flask(__name__) | |
app.secret_key = 'this is our super secret key. do not share it with anyone!' | |
login_manager = LoginManager() | |
login_manager.init_app(app) |
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
http://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes |
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
{% macro bsfield(field) -%} | |
{% set with_label = kwargs.pop('with_label', False) %} | |
{% set placeholder = '' %} | |
{% if not with_label %} | |
{% set placeholder = field.label.text %} | |
{% endif %} | |
<div class="form-group {% if field.errors %}error{% endif %}"> | |
{% if with_label %} | |
<label for="{{ field.id }}"> | |
{{ field.label.text }}{% if field.flags.required %} *{% endif %}: |
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 | |
app = Flask(__name__) | |
db = SQLAlchemy(app) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' | |
app.config['SQLALCHEMY_ECHO'] = False | |
tags = db.Table('tags', | |
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id')), |
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, request, jsonify, url_for | |
app = Flask(__name__) | |
app.secret_key = 'aib' | |
def home(): | |
return 'Ok' | |
app.add_url_rule('/', 'foo', home) |
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, request, jsonify | |
app = Flask(__name__) | |
app.secret_key = 'aib' | |
def home(): | |
return 'Ok' | |
app.add_url_rule('/', 'something', home) |