P5-4794 optimize listprice code and fix wallpaper listprice
This commit is contained in:
@@ -4,7 +4,6 @@ from datetime import datetime
|
||||
from api.extensions import db
|
||||
from flask_sqlalchemy import BaseQuery
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
|
||||
class Product(db.Model):
|
||||
@@ -99,9 +98,6 @@ class PrintProductQuery(BaseQuery):
|
||||
def framed_prints(self):
|
||||
return self.filter(PrintProduct.groupid == 8)
|
||||
|
||||
def with_relations(self):
|
||||
return self.options(joinedload("*"))
|
||||
|
||||
|
||||
class PrintProduct(db.Model):
|
||||
|
||||
@@ -115,4 +111,4 @@ class PrintProduct(db.Model):
|
||||
)
|
||||
groupid = db.Column(db.Integer, nullable=False)
|
||||
|
||||
product = db.relationship("Product", backref="printproducts")
|
||||
product = db.relationship("Product", backref="printproducts", lazy="joined")
|
||||
|
||||
Reference in New Issue
Block a user