This file contains 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
# HTML FOR SECTION 7: LECTURE 30 - SESSION OBJECT | |
# USE WITH THE PYTHON FILE PROVIDED | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>session info</title> | |
</head> | |
<body> |
This file contains 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
# PYTHON CODE FOR SECTION 7: LECTURE 30 - SESSION OBJECT | |
# USE WITH THE HTML FILE PROVIDED | |
# SEE CODE IN LINE 127 | |
from flask import Flask, render_template, request, session, g | |
from flask_sqlalchemy import SQLAlchemy | |
from datetime import datetime | |
app = Flask(__name__) | |
app.config.update( |
This file contains 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
# INCREMENTAL PYTHON CODE - REMOVED ID ATTRIBUTE FROM THE __INIT__() & __REPR__() METHODS contd., | |
# OF THE PUBLICATION TABLE TO ENABLE AUTO-POPULATION | |
# SECTION 5: LECTURE: 23 | |
from flask import Flask, render_template, request | |
from flask_sqlalchemy import SQLAlchemy | |
from datetime import datetime | |
app = Flask(__name__) | |
app.config.update( |
This file contains 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
# INCREMENTAL PYTHON CODE FOR CREATING BOOK TABLE | |
# SECTION 5: LECTURE: 22 | |
from flask import Flask, render_template, request | |
from flask_sqlalchemy import SQLAlchemy | |
from datetime import datetime | |
app = Flask(__name__) | |
app.config.update( |
This file contains 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
# INCREMENTAL PYTHON CODE FOR CREATING PUBLICATION TABLE | |
# SECTION 4: LECTURE: 20 | |
# ENTER YOUR OWN VALUE IF NEEDED FOR THE SECRET_KEY VARIABLE | |
# ENTER YOU OWN PASSWORD FOR THE DATABASE_URI | |
from flask import Flask, render_template, request | |
from flask_sqlalchemy import SQLAlchemy | |
app = Flask(__name__) |
This file contains 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
# python code for SECTION 3: LECTURE 16 | |
# JINJA2 - MACROS | |
@app.route('/macros') | |
def jinja_macros(): | |
movies_dict = {'autopsy of jane doe': 02.14, | |
'neon demon': 3.20, | |
'ghost in a shell': 1.50, | |
'kong: skull island': 3.50, | |
'john wick 2': 02.52, |
This file contains 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
<!-- SECTION 3: LECTURE 16 --> | |
{% macro render_dict(dictionary) %} | |
<table> | |
<tr> | |
<th>name</th> | |
<th>value</th> | |
<th>comments</th> |
This file contains 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
<!-- SECTION 3: LECTURE 16 --> | |
{% import 'macros.html' as my_macros %} | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>dictionary data displayed</title> | |
</head> |
This file contains 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
# incremental code - jinja2 filters | |
# SECTION 3: LECTURE 15 | |
from flask import Flask, render_template, request | |
app = Flask(__name__) | |
@app.route('/index') | |
@app.route('/') |
This file contains 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
<!-- HTML FOR - JINJA2 FILTERS --> | |
<!-- SECTION 3: LECTURE 15 --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Data Filters</title> | |
</head> |
NewerOlder