Skip to content

Commit 767862d

Browse files
committed
Release 1.2.1 prep
- adds test for the locale
1 parent 6aa5c01 commit 767862d

3 files changed

Lines changed: 46 additions & 1 deletion

File tree

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
## Unreleased
56

7+
## [1.2.1] - 2026-02-05
8+
9+
- Add locale support
610
- Add support for Python 3.13 and 3.14
711
- Add support for Django 5.1 and 5.2
812
- Add support for Wagtail 7.0, 7.1 and 7.2
@@ -27,11 +31,15 @@ All notable changes to this project will be documented in this file.
2731
- Add testing for postgres and mysql
2832

2933
## [1.0.0] - 2022-09-10
34+
3035
- [#15](https://github.com/nickmoreton/wagtail-honeypot/pull/15) Add Wagtail 3/4 support and improve developer documentation and tools
3136

3237
## [Yanked]
38+
3339
- [#14](https://github.com/nickmoreton/wagtail-honeypot/pull/14) Add Wagtail 3.0 support
3440

3541
## [0.2.0] - 2022-02-24
42+
3643
### Added
44+
3745
- Initial release

tests/test_models.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from django.test import TestCase, override_settings
2+
from django.utils.translation import gettext_lazy, override
3+
4+
from wagtail_honeypot.models import HoneypotFormMixin
5+
6+
7+
class TestHoneypotFormMixinLocale(TestCase):
8+
"""
9+
Test the locale/translation support of HoneypotFormMixin
10+
"""
11+
12+
def test_honeypot_field_verbose_name_is_translatable(self):
13+
"""
14+
Test that the honeypot field's verbose_name is a lazy translation object
15+
"""
16+
field = HoneypotFormMixin._meta.get_field("honeypot")
17+
self.assertIsInstance(field.verbose_name, type(gettext_lazy("test")))
18+
19+
def test_honeypot_field_verbose_name_default(self):
20+
"""
21+
Test that the honeypot field's verbose_name is set correctly in English
22+
"""
23+
field = HoneypotFormMixin._meta.get_field("honeypot")
24+
# Convert lazy translation to string to check content
25+
self.assertEqual(str(field.verbose_name), "Honeypot enabled")
26+
27+
@override_settings(LANGUAGE_CODE="fr")
28+
def test_honeypot_field_verbose_name_french_locale(self):
29+
"""
30+
Test that the honeypot field's verbose_name can be translated to French
31+
"""
32+
with override("fr"):
33+
field = HoneypotFormMixin._meta.get_field("honeypot")
34+
# The verbose_name should still be available for translation
35+
verbose_name = str(field.verbose_name)
36+
self.assertIsNotNone(verbose_name)
37+
self.assertTrue(len(verbose_name) > 0)

wagtail_honeypot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = (1, 1, 0)
1+
VERSION = (1, 2, 1)
22
__version__ = ".".join(map(str, VERSION))

0 commit comments

Comments
 (0)