From 5815b65328e3eb262c65ceb10e8c01514ef3177e Mon Sep 17 00:00:00 2001 From: Laurence de Bruxelles Date: Wed, 6 Jun 2018 13:58:58 +0100 Subject: [PATCH] Version bump (major) --- CHANGELOG.md | 50 +++++++++++++++++++++++++++++++++++++++++++++ dmutils/__init__.py | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eeb97ba..2820b2da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,56 @@ Records breaking changes from major version bumps +## 39.0.0 + +PR [#400](https://github.com/alphagov/digitalmarketplace-utils/pull/400) + +This bump introduces new classes for using WTForms with the frontend toolkit in a way that is unambiguous. This is not a breaking change, but apps which use this version of `dmutils` should aim to use this new feature everywhere where WTForms is used so that our code is consistent across the board. + +Old code: +``` +# app/main/forms/form.py +from flask_wtf import FlaskForm +from dmutils.forms import StripWhitespaceStringField + +class NameForm(FlaskForm): + full_name = StripWhitespaceStringField() +-- +# app/templates/name.html +{% + with + name = "full_name", + question = "What is your name?", + hint = "Enter your full name.", + value = form.full_name.data, + error = errors.get("full_name", {}).get("message", None) +%} +``` + + +New code: +``` +# app/main/forms/form.py +from flask_wtf import FlaskForm +from dmutils.forms.dm_fields import DMStripWhitespaceStringField + +class NameForm(FlaskForm): + full_name = DMStripWhitespaceStringField( + "What is your name?", + hint="Enter your full name.") +-- +# app/templates/name.html +{% + with + name = form.full_name.name, + question = form.full_name.question, + hint = form.full_name.hint, + value = form.full_name.value, + error = form.full_name.error +%} +``` + + ## 38.0.0 PR [#397](https://github.com/alphagov/digitalmarketplace-utils/pull/397) diff --git a/dmutils/__init__.py b/dmutils/__init__.py index cae5db76..3cb4386a 100644 --- a/dmutils/__init__.py +++ b/dmutils/__init__.py @@ -4,4 +4,4 @@ import flask_featureflags # noqa -__version__ = '38.2.0' +__version__ = '39.0.0'