⚠️ Push biežāk GIT, lai nav tā, ka pēdējā brīdī neko neredzu

object relational mapping
https://docs.sqlalchemy.org/en/20/orm/quickstart.html
xxxxxxxxxx241from flask import Flask2from flask_sqlalchemy import SQLAlchemy34app = Flask(__name__)5app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///mydatabase.db'6db = SQLAlchemy(app)78class User(db.Model):9id = db.Column(db.Integer, primary_key=True)10username = db.Column(db.String(80), unique=True, nullable=False)11email = db.Column(db.String(120), unique=True, nullable=False)1213def __repr__(self):14return '<User %r>' % self.username1516if __name__ == '__main__':17# Create the database tables18db.create_all()1920# Perform database operations21# ...2223# Run the Flask application24app.run()







Uztaisīt bez flask_login
Video: https://youtube.com/live/dp9kGvgHuOQ?feature=share
Jamboard: https://jamboard.google.com/d/1qmOj3J4hwlCL4QlzuFIsCeYiCYhB-PnZQBY0haVnvlo/edit?usp=sharing
Template: http://share.yellowrobot.xyz/1629812987-programming-tutorials/session_2.zip
Video: https://youtu.be/6LV6df_JWbs
Jamboard: https://jamboard.google.com/d/1ZrLZ2_WvgmvVBRsponJ8BeBckXm3alElUV3IrIC1Vv4/edit?usp=sharing
Template: http://share.yellowrobot.xyz/1629812987-programming-tutorials/session_3.zip
Tasks:
Post delete function using HTML form, ControllerPosts and ControllerDatabase
Ability to save url_slug and open URL using slug instead of post_id, for example http://localhost:8000/posts/my_post_title
Submit whole project as ZIP
Video: https://youtu.be/OSvtOrJ7bHw
Jamboard: https://jamboard.google.com/d/1S3oYruAJmrakj7fn0xbGQ_xJfI1u_pY289MjDQGCgNs/edit?usp=sharing
Template: http://share.yellowrobot.xyz/1629812987-programming-tutorials/session_4.zip
Tasks:
Implement so that after deletion and editing user is redirected to home page and sees message "post deleted" or "post updated"
Implement so that in home page you see list of all recorded posts (title and date of editing) and link to open editing form
Implement editing form (reuse new post form) when opening existing post fill fields with existing information
Submit whole project as ZIP