Added a bit of style to edit.html
Added buy capability to view with dialog Added additional properties to Item (url and imageurl); NEEDS TESTING Made delete items work properly
This commit is contained in:
parent
3ba6099976
commit
05c40d0148
9 changed files with 222 additions and 82 deletions
|
|
@ -1,35 +1,42 @@
|
|||
from typing import List
|
||||
from app import db
|
||||
from sqlalchemy.orm import Mapped, mapped_column, RelationshipProperty
|
||||
from sqlalchemy import Uuid, String, Text
|
||||
from uuid import uuid4 as uuid
|
||||
from sqlalchemy.orm import Mapped, mapped_column, RelationshipProperty, relationship
|
||||
from sqlalchemy import Uuid, String, Text, String, ForeignKey
|
||||
from uuid import uuid4 as uuid, UUID
|
||||
|
||||
|
||||
class Item(db.Model):
|
||||
def __init__(self, title: str, description: str, price: float):
|
||||
self.wishlist_id = None
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.price = price
|
||||
self.bought = False
|
||||
def __init__(
|
||||
self, title: str, description: str, price: float, url: str, image: str
|
||||
):
|
||||
self.bought = False
|
||||
self.wishlist_id = None
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.price = price
|
||||
self.url = url
|
||||
self.image = image
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
wishlist_id: Mapped[int | None] = mapped_column(ForeignKey("wishlist.id"))
|
||||
title: Mapped[str] = mapped_column(String(250))
|
||||
description: Mapped[str] = mapped_column(Text)
|
||||
price: Mapped[float] = mapped_column()
|
||||
url: Mapped[str] = mapped_column(Text)
|
||||
image: Mapped[str] = mapped_column(Text)
|
||||
bought: Mapped[bool] = mapped_column()
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
wishlist_id: Mapped[int | None] = mapped_column(db.ForeignKey("wishlist.id"))
|
||||
title: Mapped[str] = mapped_column(db.String(250))
|
||||
description: Mapped[str] = mapped_column(db.Text)
|
||||
price: Mapped[float] = mapped_column()
|
||||
bought: Mapped[bool] = mapped_column()
|
||||
|
||||
class Wishlist(db.Model):
|
||||
def __init__(self, title: str, description: str):
|
||||
self.editId = uuid()
|
||||
self.viewId = uuid()
|
||||
self.title = title
|
||||
self.description = description
|
||||
def __init__(self, title: str, description: str):
|
||||
self.editId = uuid()
|
||||
self.viewId = uuid()
|
||||
self.title = title
|
||||
self.description = description
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
editId: Mapped[Uuid] = mapped_column(Uuid)
|
||||
viewId: Mapped[Uuid] = mapped_column(Uuid)
|
||||
title: Mapped[str] = mapped_column(String(250))
|
||||
description: Mapped[str] = mapped_column(Text)
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
editId: Mapped[UUID] = mapped_column(Uuid)
|
||||
viewId: Mapped[UUID] = mapped_column(Uuid)
|
||||
title: Mapped[str] = mapped_column(String(250))
|
||||
description: Mapped[str] = mapped_column(Text)
|
||||
|
||||
items: Mapped[List["Item"]] = db.relationship("Item", backref="post")
|
||||
items: Mapped[list["Item"]] = relationship("Item", backref="post")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue