Compare commits

...

2 commits

Author SHA1 Message Date
2998e67548 bump: version 0.12.0 → 0.12.1 2026-05-31 11:58:48 -05:00
fbae0bcfc8 fix: allow null for Quantity.measure field
since apparently that is optional, e.g. for "Precipitation" quick form
logs
2026-05-31 11:58:07 -05:00
5 changed files with 52 additions and 4 deletions

View file

@ -5,6 +5,12 @@ All notable changes to WuttaFarm will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## v0.12.1 (2026-05-31)
### Fix
- allow null for `Quantity.measure` field
## v0.12.0 (2026-05-30)
### Feat

View file

@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "WuttaFarm"
version = "0.12.0"
version = "0.12.1"
description = "Web app to integrate with and extend farmOS"
readme = "README.md"
authors = [

View file

@ -0,0 +1,36 @@
"""allow null for quantity.measure_id
Revision ID: c30a725b54f9
Revises: a240a1449de9
Create Date: 2026-05-30 22:14:21.056993
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import wuttjamaican.db.util
# revision identifiers, used by Alembic.
revision: str = "c30a725b54f9"
down_revision: Union[str, None] = "a240a1449de9"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# quantity
op.alter_column(
"quantity", "measure_id", existing_type=sa.VARCHAR(length=20), nullable=True
)
def downgrade() -> None:
# quantity
op.alter_column(
"quantity", "measure_id", existing_type=sa.VARCHAR(length=20), nullable=False
)

View file

@ -109,7 +109,7 @@ class Quantity(model.Base):
measure_id = sa.Column(
sa.String(length=20),
sa.ForeignKey("measure.drupal_id"),
nullable=False,
nullable=True,
doc="""
Measure for the quantity.
""",
@ -192,8 +192,13 @@ class Quantity(model.Base):
app = config.get_app()
value = app.render_quantity(value)
units = str(self.units or "")
if measure:
return f"( {measure} ) {value} {units}"
label = self.label or ""
return f"{label} {value} {units}"
def __str__(self):
return self.render_as_text()

View file

@ -298,6 +298,7 @@ class QuantityMasterView(WuttaFarmMasterView):
f.remove("measure")
else:
f.set_readonly("measure")
if quantity.measure:
f.set_default("measure", quantity.measure.name)
# value