Skip to content

Commit

Permalink
fix: Preserve blank value for optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
last-partizan committed Dec 26, 2024
1 parent 1b0bf21 commit 83a3584
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modeltranslation/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3871,3 +3871,19 @@ def test_managers_failure(self):
), "Permission is using MultilingualManager"
user = User.objects.create(username="123", is_active=True)
user.has_perm("test_perm")


@pytest.mark.parametrize(
"field_name,expected",
[
("title", False),
("title_en", True),
("title_de", True),
("text", True),
("text_en", True),
("text_de", True),
],
)
def test_field_blank_attrs(field_name: str, expected: bool):
field = models.TestModel._meta.get_field(field_name)
assert field.blank is expected

0 comments on commit 83a3584

Please sign in to comment.