diff --git a/CHANGELOG.md b/CHANGELOG.md index d392b59..e6d7b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,6 @@ 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 diff --git a/pyproject.toml b/pyproject.toml index 16c7c60..cc46ec7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "WuttaFarm" -version = "0.12.1" +version = "0.12.0" description = "Web app to integrate with and extend farmOS" readme = "README.md" authors = [ diff --git a/src/wuttafarm/db/alembic/versions/c30a725b54f9_allow_null_for_quantity_measure_id.py b/src/wuttafarm/db/alembic/versions/c30a725b54f9_allow_null_for_quantity_measure_id.py deleted file mode 100644 index 2c5952d..0000000 --- a/src/wuttafarm/db/alembic/versions/c30a725b54f9_allow_null_for_quantity_measure_id.py +++ /dev/null @@ -1,36 +0,0 @@ -"""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 - ) diff --git a/src/wuttafarm/db/model/quantities.py b/src/wuttafarm/db/model/quantities.py index c04f85b..4fa92af 100644 --- a/src/wuttafarm/db/model/quantities.py +++ b/src/wuttafarm/db/model/quantities.py @@ -109,7 +109,7 @@ class Quantity(model.Base): measure_id = sa.Column( sa.String(length=20), sa.ForeignKey("measure.drupal_id"), - nullable=True, + nullable=False, doc=""" Measure for the quantity. """, @@ -192,12 +192,7 @@ 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}" + return f"( {measure} ) {value} {units}" def __str__(self): return self.render_as_text() diff --git a/src/wuttafarm/web/views/quantities.py b/src/wuttafarm/web/views/quantities.py index 05f624b..9a91941 100644 --- a/src/wuttafarm/web/views/quantities.py +++ b/src/wuttafarm/web/views/quantities.py @@ -298,8 +298,7 @@ class QuantityMasterView(WuttaFarmMasterView): f.remove("measure") else: f.set_readonly("measure") - if quantity.measure: - f.set_default("measure", quantity.measure.name) + f.set_default("measure", quantity.measure.name) # value if self.creating: