v1.4: group folder/photo limits and ad banners
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from app.models import AdBanner
|
||||
|
||||
|
||||
def get_banners(position=None):
|
||||
query = AdBanner.query.filter_by(is_active=True).order_by(AdBanner.sort_order, AdBanner.id)
|
||||
if position:
|
||||
query = query.filter_by(position=position)
|
||||
return query.all()
|
||||
|
||||
|
||||
def get_banners_by_position():
|
||||
banners = get_banners()
|
||||
grouped = {}
|
||||
for banner in banners:
|
||||
grouped.setdefault(banner.position, []).append(banner)
|
||||
return grouped
|
||||
Reference in New Issue
Block a user