working, images broken

This commit is contained in:
2025-06-23 04:08:45 -05:00
parent 2bb7a29141
commit 23fee50a77
7 changed files with 135 additions and 79 deletions

View File

@ -1,5 +1,7 @@
from uuid import uuid4
import os
from sqlalchemy.orm import joinedload
from flask import (
Blueprint,
render_template,
@ -10,6 +12,7 @@ from flask import (
current_app,
)
from flask_login import login_required, current_user
from app import db
from .models import Plant, PlantCommonName, PlantScientificName
from .forms import PlantForm
@ -37,7 +40,9 @@ def inject_image_helper():
@login_required
def index():
plants = (
Plant.query.filter_by(owner_id=current_user.id)
Plant.query
.options(joinedload(Plant.media_items))
.filter_by(owner_id=current_user.id)
.order_by(Plant.id.desc())
.all()
)