Skip to content

forms.py

CommentForm

Bases: ModelForm

The form used for users to leave comments on objects.

Source code in vast_pipeline/forms.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class CommentForm(forms.ModelForm):
    """
    The form used for users to leave comments on objects.
    """
    class Meta:
        model = Comment
        fields = ["comment"]

    def __init__(self, *args, **kwargs) -> None:
        """
        Initialise a CommentForm.

        Returns:
            None.
        """
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("comment", rows=2),
        )
        self.helper.add_input(Submit("submit", "Submit"))

__init__(*args, **kwargs)

Initialise a CommentForm.

Returns:

Type Description
None

None.

Source code in vast_pipeline/forms.py
49
50
51
52
53
54
55
56
57
58
59
60
61
def __init__(self, *args, **kwargs) -> None:
    """
    Initialise a CommentForm.

    Returns:
        None.
    """
    super().__init__(*args, **kwargs)
    self.helper = FormHelper()
    self.helper.layout = Layout(
        Field("comment", rows=2),
    )
    self.helper.add_input(Submit("submit", "Submit"))

PipelineRunForm

Bases: Form

Class for the form used in the creation of a new pipeline run through the webserver.

Source code in vast_pipeline/forms.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class PipelineRunForm(forms.Form):
    """
    Class for the form used in the creation of a new pipeline run through the
    webserver.
    """
    run_name = forms.CharField(
        max_length=Run._meta.get_field('name').max_length
    )
    run_description = forms.CharField(widget=forms.Textarea(), required=False)
    monitor = forms.BooleanField(required=False)
    monitor_min_sigma = forms.FloatField()
    monitor_edge_buffer_scale = forms.FloatField()
    monitor_cluster_threshold = forms.FloatField()
    monitor_allow_nan = forms.BooleanField(required=False)
    association_method = forms.CharField()
    association_radius = forms.FloatField()
    association_de_ruiter_radius = forms.FloatField()
    association_parallel = forms.BooleanField(required=False)
    association_epoch_duplicate_radius = forms.FloatField()
    astrometric_uncertainty_ra = forms.FloatField()
    astrometric_uncertainty_dec = forms.FloatField()
    new_source_min_sigma = forms.FloatField()
    association_beamwidth_limit = forms.FloatField()
    flux_perc_error = forms.FloatField()
    selavy_local_rms_zero_fill_value = forms.FloatField()
    source_aggregate_pair_metrics_min_abs_vs = forms.FloatField()
    pair_metrics = forms.BooleanField(required=False)
    use_condon_errors = forms.BooleanField(required=False)
    create_measurements_arrow_files = forms.BooleanField(required=False)
    suppress_astropy_warnings = forms.BooleanField(required=False)

TagWithCommentsForm

Bases: Form

Class to combined tags with the CommentsForm.

Source code in vast_pipeline/forms.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class TagWithCommentsForm(forms.Form):
    """
    Class to combined tags with the CommentsForm.
    """
    comment = forms.CharField(required=False, widget=forms.Textarea())
    tags = tagulous.forms.TagField(
        required=False,
        tag_options=tagulous.models.TagOptions(**Source.tags.tag_options.items()),
    )

    def __init__(self, *args, **kwargs) -> None:
        """
        Initialise a TagWithCommentsForm.

        Returns:
            None.
        """
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("tags"),
            Field(
                "comment",
                rows=2,
                placeholder=(
                    "Optional. If changing the tags, you should provide justification here."
                ),
            ),
            Submit("submit", "Submit", css_class="btn-block"),
        )

__init__(*args, **kwargs)

Initialise a TagWithCommentsForm.

Returns:

Type Description
None

None.

Source code in vast_pipeline/forms.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def __init__(self, *args, **kwargs) -> None:
    """
    Initialise a TagWithCommentsForm.

    Returns:
        None.
    """
    super().__init__(*args, **kwargs)
    self.helper = FormHelper()
    self.helper.layout = Layout(
        Field("tags"),
        Field(
            "comment",
            rows=2,
            placeholder=(
                "Optional. If changing the tags, you should provide justification here."
            ),
        ),
        Submit("submit", "Submit", css_class="btn-block"),
    )