-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c2d245
commit f1e6310
Showing
94 changed files
with
1,985 additions
and
4,609 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from flask import current_app as app | ||
|
||
|
||
@app.cli.command("show-config") | ||
def show_config(): | ||
print(app.config) |
14 changes: 14 additions & 0 deletions
14
app_full/resources/context_processors/context_processors.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from flask import current_app as app | ||
|
||
|
||
@app.context_processor | ||
def example__utility_processor(): | ||
""" | ||
Usage: | ||
{{ example__format_price(100.33) }} -> $100.33 | ||
""" | ||
|
||
def example__format_price(amount, currency='$'): | ||
return '{1}{0:.2f}'.format(amount, currency) | ||
|
||
return dict(example__format_price=example__format_price) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from flask import current_app as app | ||
|
||
|
||
@app.template_filter('example__num_to_month') | ||
def example__num_to_month(num: str) -> str: | ||
""" | ||
Usage: | ||
{{ 1 | example__num_to_month }} -> January | ||
""" | ||
if isinstance(num, int): | ||
num = str(num) | ||
|
||
months = { | ||
"1": "January", | ||
"2": "February", | ||
"3": "March", | ||
"4": "April", | ||
"5": "May", | ||
"6": "June", | ||
"7": "July", | ||
"8": "August", | ||
"9": "September", | ||
"10": "October", | ||
"11": "November", | ||
"12": "December", | ||
} | ||
|
||
if num in months: | ||
return months[num] | ||
return "Month not found" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from flask import current_app as app | ||
|
||
|
||
@app.route("/example--resources") | ||
def example_route(): | ||
return "From the [app_root]/resources/routes/routes.py file" |
Oops, something went wrong.