Skip to content

Commit

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

Records breaking changes from major version bumps

## 42.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)
%}
{% include "toolkit/forms/textbox.html" %}
{% endwith %}
```


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
{{ form.full_name }}
```

## 41.0.0

PR [431](https://github.com/alphagov/digitalmarketplace-utils/pull/431)
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__ = '41.2.1'
__version__ = '42.0.0'

0 comments on commit a8ce893

Please sign in to comment.