Skip to content

Commit 809533d

Browse files
committed
Add max length option on Titleblocks that sets maxlength attribute.
1 parent f4056a8 commit 809533d

3 files changed

Lines changed: 1645 additions & 0 deletions

File tree

hypha/apply/funds/blocks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ class TitleBlock(ApplicationMustIncludeFieldBlock):
3535
label=_("Help text"),
3636
default=_("This project name can be changed if a full proposal is requested."),
3737
)
38+
max_length = blocks.IntegerBlock(required=False, label=_("Max length"))
3839

3940
class Meta:
4041
label = _("Application title")
4142
icon = "tag"
4243

44+
def get_field_kwargs(self, struct_value):
45+
kwargs = super().get_field_kwargs(struct_value)
46+
kwargs["max_length"] = struct_value["max_length"]
47+
return kwargs
48+
4349

4450
class ValueBlock(ApplicationSingleIncludeFieldBlock):
4551
name = "value"

0 commit comments

Comments
 (0)