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
# code for the lesson "jinja templating part 2" | |
# section 3: lecture 13 | |
# USE THIS CODE IN CONJUNCTION WITH THE HTML PROVIDED | |
from flask import Flask, render_template, request | |
app = Flask(__name__) | |
@app.route('/index') |
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
/* THESE STYLES ARE FOR THE TABLE IN SECTION 3: LECTURE 14 */ | |
table { | |
border-collapse: collapse; | |
width: 35%; | |
} | |
td, th { | |
border: 1px solid #dddddd; | |
text-align: left; |
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
<!-- HTML FOR SECTION 3: LECTURE 14 --> | |
<!-- ADDED CSS USING UR_FOR METHOD TO THIS HTML FILE IN LINE 10 --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>movie durations</title> | |
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}"> |
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
<!-- HTML FOR - JINJA2 FILTERS --> | |
<!-- SECTION 3: LECTURE 15 --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Data Filters</title> | |
</head> |
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
# 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 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
<!-- 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 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
<!-- SECTION 3: LECTURE 16 --> | |
{% macro render_dict(dictionary) %} | |
<table> | |
<tr> | |
<th>name</th> | |
<th>value</th> | |
<th>comments</th> |
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
# 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 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
# 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 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
# 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( |