This commit is contained in:
2025-07-09 01:05:45 -05:00
parent 1bbe6e2743
commit d7a610a83b
113 changed files with 1512 additions and 2348 deletions

View File

@ -1,4 +1,4 @@
# plugins/plant/growlog/routes.py
# File: plugins/plant/growlog/routes.py
from uuid import UUID as _UUID
from flask import (
@ -7,6 +7,7 @@ from flask import (
)
from flask_login import login_required, current_user
from app import db
from app.celery_app import celery
from .models import GrowLog
from .forms import GrowLogForm
from plugins.plant.models import Plant, PlantCommonName
@ -18,6 +19,7 @@ bp = Blueprint(
template_folder='templates',
)
def _get_plant_by_uuid(uuid_val):
"""
Normalize & validate a UUID (may be a uuid.UUID or a string),
@ -40,6 +42,7 @@ def _get_plant_by_uuid(uuid_val):
.first_or_404()
)
def _user_plant_choices():
"""
Return [(uuid, "Common Name uuid"), ...] for all plants
@ -103,9 +106,6 @@ def add_log(plant_uuid=None):
@bp.route('/<uuid:plant_uuid>')
@login_required
def list_logs(plant_uuid):
from plugins.utility.celery import celery_app
celery_app.send_task('plugins.utility.tasks.ping')
limit = request.args.get('limit', default=10, type=int)
if plant_uuid:

View File

@ -90,6 +90,7 @@ class Plant(db.Model):
price = db.Column(db.Numeric(10, 2), nullable=True)
is_active = db.Column(db.Boolean, default=True, nullable=False)
is_public = db.Column(db.Boolean, nullable=False, default=False)
featured_media_id = db.Column(db.Integer, db.ForeignKey('media.id'), nullable=True)
created_at = db.Column(db.DateTime, default=datetime.utcnow)