Skip to content

Blocks

hypha.apply.projects.blocks

ProjectFormCustomFormFieldsBlock

ProjectFormCustomFormFieldsBlock(*args, **kwargs)

Bases: CustomFormFieldsBlock, FormFieldsBlock

A block that can be used for customizable Project-related forms: PAF, SOW, and Report.

Source code in hypha/apply/utils/blocks.py
def __init__(self, *args, **kwargs):
    # The space before " Required" is to make the group sort first. Ugly but easy, and it works.
    child_blocks = [
        (block.name, block(group=_(" Required"))) for block in self.required_blocks
    ]
    child_blocks += [
        (block.name, block(group=_("Custom"))) for block in self.single_blocks
    ]
    self.required_block_names = [block.name for block in self.required_blocks]
    self.single_block_names = [
        block.name for block in self.single_blocks
    ] + self.required_block_names

    super().__init__(child_blocks, *args, **kwargs)