Form could be useful for creating fields like Education interval or Work Experience interval. You could see such fields on facebook and linkedin.
Using: Flask, WTForms, SQLAlchemy, jQuery, Bootstrap
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext.wtf import Form | |
from flask.ext.babel import gettext | |
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField | |
from wtforms.validators import Optional, Required | |
app = Flask(__name__) | |
db = SQLAlchemy(app) |
# Execute plain query | |
db.engine.execute("Query here") | |
result = db.engine.execute("Query here") | |
for row in result: | |
print(row['id']) |
# Caching results in SELECT choices | |
# http://stackoverflow.com/questions/10368900/how-to-make-wtforms-read-from-the-datastore | |
# Choices will be cached | |
def get_clients_list_choices(): | |
choices = [(0, '')] | |
clients = Client.query.order_by('company') | |
for client in clients: | |
choices.append((client.id, client.fullname)) | |
return choices |
# list of files in current dir | |
$ ls -la | |
# open file for reading | |
$ cat filename | |
# open file for changes | |
$ nano filename | |
# remove folter and its contain |
# Install | |
# http://postgresapp.com/ | |
# http://postgresapp.com/documentation/cli-tools.html | |
DROP USER <username>; | |
CREATE USER <username> WITH PASSWORD '<password>'; | |
CREATE DATABASE <database-name>; | |
GRANT ALL privileges ON DATABASE <database-name> TO <username>; | |
# Create DB |
# N to M relationship without association_proxy | |
from sqlalchemy import create_engine, ForeignKey, Column, Integer, String, Table | |
from sqlalchemy.orm import backref, Session, relationship | |
from sqlalchemy.ext.declarative import declarative_base | |
engine = create_engine('sqlite:///', echo=False) | |
Base = declarative_base() | |
session = Session(bind=engine) |
// check that event.target is the one that we need | |
var isNavbarToogle = event.target.path.filter(function(item) { | |
return (item.classList.contains("navbar-toggle") || item.classList.contains("navbar-header")); | |
}).length == 2; | |
// to know when gulp task is end | |
Gulp.task("name", function () { | |
console.log('started >>>'); | |
return ..... | |
.pipe(Gulp.dest("build")) |
// http://jquense.github.io/react-widgets/docs/#/datetime-picker | |
// | |
// <form> | |
// [date] [time] | |
// </form> | |
// | |
// Both fields return datetime format: | |
// To compine them in one | |
let dateField = "Fri Jun 12 2015 15:08:31 GMT+0200"; |
*Compilation JS with gulp-browserify* | |
Case # 0. Any error in NOT included files | |
Result: no errors by compilation and running | |
Case # 1. Missed lib on the disk | |
app.js |