Skip to content

Commit

Permalink
Version bump (major)
Browse files Browse the repository at this point in the history
  • Loading branch information
lfdebrux committed Jul 2, 2018
1 parent 7bbc339 commit b2d0cf8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,59 @@

Records breaking changes from major version bumps

## 41.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.

The fields in `dmutils.forms.fields` module have been rewritten to use the new `DMFieldMixin`. Fields which use the mixin can be identified by the 'DM' prefix.

Apps which use this version of `dmutils` should aim to use the new classes 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
%}
```

## 40.0.0

PR [414](https://github.com/alphagov/digitalmarketplace-utils/pull/414)
Expand Down
2 changes: 1 addition & 1 deletion dmutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
import flask_featureflags # noqa


__version__ = '40.0.0'
__version__ = '41.0.0'

0 comments on commit b2d0cf8

Please sign in to comment.