generated from prof-rossetti/flask-sheets-template-2023
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates: + Simplifies spreadsheet model class interface, by abstracting the logic into, and using, the [`gspread_models` package](https://pypi.org/project/gspread-models/). + Bumps version of the "google-auth" GitHub Action. + Moves client side logic (the icon class and navbar color class definitions) into the bootstrap template HTML file. + Allows page-specific customization of HTML `<title>` tag content, as desired. FYI: + Google OAuth no longer provides the user's "locale" (language) Known Issues: + #5 (Broken Profile Image) Next Steps: + #3 (Markdown Instructions)
- Loading branch information
Showing
41 changed files
with
687 additions
and
876 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
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
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
|
||
import os | ||
|
||
from dotenv import load_dotenv | ||
from gspread_models.service import SpreadsheetService | ||
from gspread_models.base import BaseModel | ||
|
||
load_dotenv() | ||
|
||
# google credentials: | ||
DEFAULT_FILEPATH = os.path.join(os.path.dirname(__file__), "..", "google-credentials.json") | ||
GOOGLE_CREDENTIALS_FILEPATH = os.getenv("GOOGLE_CREDENTIALS_FILEPATH", default=DEFAULT_FILEPATH) | ||
|
||
# google sheets document: | ||
GOOGLE_SHEETS_DOCUMENT_ID = os.getenv("GOOGLE_SHEETS_DOCUMENT_ID", default="OOPS, Please get the spreadsheet identifier from its URL, and set the 'GOOGLE_SHEETS_DOCUMENT_ID' environment variable accordingly...") | ||
|
||
# configure the base model to use this info: | ||
service = SpreadsheetService( | ||
credentials_filepath=GOOGLE_CREDENTIALS_FILEPATH, | ||
document_id=GOOGLE_SHEETS_DOCUMENT_ID | ||
) | ||
BaseModel.service = service | ||
|
||
# now you can import the base model from here, and child model classes will use the configured document | ||
# see: https://pypi.org/project/gspread-models/ |
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,35 @@ | ||
|
||
#from app.db import BaseModel | ||
# | ||
#class Book(BaseModel): | ||
# | ||
# SHEET_NAME = "books" | ||
# | ||
# COLUMNS = ["title", "author", "year"] | ||
# | ||
# SEEDS = [ | ||
# {"title": "To Kill a Mockingbird", "author": "Harper Lee", "year": 1960}, | ||
# {"title": "1984", "author": "George Orwell", "year": 1949}, | ||
# {"title": "The Great Gatsby", "author": "F. Scott Fitzgerald", "year": 1925}, | ||
# {"title": "The Catcher in the Rye", "author": "J.D. Salinger", "year": 1951}, | ||
# {"title": "Pride and Prejudice", "author": "Jane Austen", "year": 1813}, | ||
# {"title": "To the Lighthouse", "author": "Virginia Woolf", "year": 1927}, | ||
# {"title": "The Hobbit", "author": "J.R.R. Tolkien", "year": 1937}, | ||
# {"title": "Moby-Dick", "author": "Herman Melville", "year": 1851}, | ||
# {"title": "Brave New World", "author": "Aldous Huxley", "year": 1932}, | ||
# {"title": "Alice's Adventures in Wonderland", "author": "Lewis Carroll", "year": 1865}, | ||
# {"title": "Harry Potter and the Philosopher's Stone", "author": "J.K. Rowling", "year": 1997}, | ||
# {"title": "Harry Potter and the Chamber of Secrets", "author": "J.K. Rowling", "year": 1998}, | ||
# ] | ||
# | ||
# | ||
#if __name__ == "__main__": | ||
# | ||
# books = Book.all() | ||
# print("FOUND", len(books), "BOOKS") | ||
# if any(books): | ||
# for book in books: | ||
# print(book.title, book.author, book.year) | ||
# else: | ||
# Book.seed() | ||
# |
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,9 @@ | ||
|
||
#from app.db import BaseModel | ||
# | ||
#class Login(BaseModel): | ||
# | ||
# SHEET_NAME = "logins" | ||
# | ||
# COLUMNS = ["email", "verified", "first_name", "last_name", "profile_photo_url"] | ||
# |
Oops, something went wrong.