Allow ordering packages in collections

This commit is contained in:
rubenwardy
2023-08-20 22:51:21 +01:00
parent 4bd53e4b1a
commit e5e68826fb
4 changed files with 59 additions and 25 deletions

View File

@@ -57,7 +57,7 @@ class Collection(db.Model):
private = db.Column(db.Boolean, nullable=False, default=False)
packages = db.relationship("Package", secondary=CollectionPackage.__table__, backref="collections")
items = db.relationship("CollectionPackage", back_populates="collection", order_by=db.asc("created_at"),
items = db.relationship("CollectionPackage", back_populates="collection", order_by=db.asc("order"),
cascade="all, delete, delete-orphan")
collection_name_valid = db.CheckConstraint("name ~* '^[a-z0-9_]+$' AND name != '_game'")