Make upload.unturf.com's media listing page optimized by _not_ loading base64 column
This commit is contained in:
parent
4bca7ef72a
commit
80a5e8eda8
1 changed files with 23 additions and 5 deletions
28
app.py
28
app.py
|
|
@ -34,9 +34,13 @@ from sqlalchemy import (
|
|||
Text,
|
||||
or_,
|
||||
)
|
||||
from sqlalchemy.orm import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.orm import scoped_session, relationship
|
||||
from sqlalchemy.orm import (
|
||||
declarative_base,
|
||||
sessionmaker,
|
||||
scoped_session,
|
||||
relationship,
|
||||
load_only,
|
||||
)
|
||||
from sqlalchemy.pool import StaticPool
|
||||
from waitress import serve
|
||||
|
||||
|
|
@ -1231,9 +1235,23 @@ def list_media_view(request):
|
|||
if not check_namespace_permission(request, "reader"):
|
||||
return HTTPForbidden("You do not have access to this namespace.")
|
||||
|
||||
# Get the media items
|
||||
# Get the media items, excluding the media_b64 column
|
||||
media_items = (
|
||||
namespace_dbsession.query(Media).order_by(Media.upload_date.desc()).all()
|
||||
namespace_dbsession.query(Media)
|
||||
.options(
|
||||
load_only(
|
||||
Media.id,
|
||||
Media.short_id,
|
||||
Media.filename,
|
||||
Media.title,
|
||||
Media.media_type,
|
||||
Media.upload_date,
|
||||
Media.is_public,
|
||||
Media.size,
|
||||
)
|
||||
)
|
||||
.order_by(Media.upload_date.desc())
|
||||
.all()
|
||||
)
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue