• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gcivil-nyu-org / team4-wed-fall25 / 55

03 Nov 2025 03:34PM UTC coverage: 56.582% (+7.8%) from 48.812%
55

push

travis-pro

web-flow
Syncing the develop and main branch

Syncing Prod and Dev

201 of 388 new or added lines in 11 files covered. (51.8%)

5 existing lines in 1 file now uncovered.

447 of 790 relevant lines covered (56.58%)

0.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

32.73
/note2webapp/forms.py
1
from django import forms
1✔
2
from .models import ModelUpload, ModelVersion
1✔
3

4

5
# -------------------------
6
# Upload Form (for new upload)
7
# -------------------------
8
class UploadForm(forms.ModelForm):
1✔
9
    class Meta:
1✔
10
        model = ModelUpload
1✔
11
        fields = ["name"]
1✔
12

13

14
# -------------------------
15
# Version Form (for new version)
16
# -------------------------
17
class VersionForm(forms.ModelForm):
1✔
18
    information = forms.CharField(
1✔
19
        widget=forms.Textarea(
20
            attrs={
21
                "rows": 4,
22
                "placeholder": "Enter information about this model version...",
23
            }
24
        ),
25
        required=True,  # CHANGE THIS FROM False TO True
26
        label="Model Information",
27
        help_text="Required: Add relevant information about this version",
28
    )
29

30
    class Meta:
1✔
31
        model = ModelVersion
1✔
32
        fields = [
1✔
33
            "model_file",
34
            "predict_file",
35
            "schema_file",
36
            "tag",
37
            "category",
38
            "information",
39
        ]
40
        widgets = {
1✔
41
            "model_file": forms.FileInput(attrs={"required": False}),
42
            "predict_file": forms.FileInput(attrs={"required": False}),
43
            "schema_file": forms.FileInput(attrs={"required": False}),
44
        }
45

46
    def __init__(self, *args, **kwargs):
1✔
NEW
47
        super().__init__(*args, **kwargs)
×
48
        # Don't set required in __init__ - let JavaScript handle validation
NEW
49
        self.fields["model_file"].required = False
×
NEW
50
        self.fields["predict_file"].required = False
×
NEW
51
        self.fields["schema_file"].required = False
×
52
        # Add help text
NEW
53
        self.fields["model_file"].help_text = "Required: Upload your .pt model file"
×
NEW
54
        self.fields["predict_file"].help_text = (
×
55
            "Required: Upload your .py prediction script"
56
        )
NEW
57
        self.fields["schema_file"].help_text = "Required: Upload your .json schema file"
×
58

59
    def clean(self):
1✔
NEW
60
        cleaned_data = super().clean()
×
NEW
61
        model_file = cleaned_data.get("model_file")
×
NEW
62
        predict_file = cleaned_data.get("predict_file")
×
NEW
63
        schema_file = cleaned_data.get("schema_file")
×
NEW
64
        information = cleaned_data.get("information")
×
65
        # Backend validation
NEW
66
        if not model_file:
×
NEW
67
            raise forms.ValidationError("Model file (.pt) is required")
×
NEW
68
        if not predict_file:
×
NEW
69
            raise forms.ValidationError("Predict file (.py) is required")
×
NEW
70
        if not schema_file:
×
NEW
71
            raise forms.ValidationError("Schema file (.json) is required")
×
NEW
72
        if not information or not information.strip():
×
NEW
73
            raise forms.ValidationError("Model Information is required")
×
NEW
74
        return cleaned_data
×
75

76
    def clean_model_file(self):
1✔
77
        file = self.cleaned_data.get("model_file")
×
78
        if file and not file.name.endswith(".pt"):
×
79
            raise forms.ValidationError("Only .pt files are allowed for Model File")
×
80
        return file
×
81

82
    def clean_predict_file(self):
1✔
83
        file = self.cleaned_data.get("predict_file")
×
84
        if file and not file.name.endswith(".py"):
×
85
            raise forms.ValidationError("Only .py files are allowed for Predict File")
×
86
        return file
×
87

88
    def clean_schema_file(self):
1✔
89
        file = self.cleaned_data.get("schema_file")
×
90
        if file and not file.name.endswith(".json"):
×
91
            raise forms.ValidationError("Only .json files allowed for schema")
×
92
        return file
×
93

94
    def clean_tag(self):
1✔
95
        tag = self.cleaned_data.get("tag")
×
96
        if not tag:
×
97
            raise forms.ValidationError("Tag is required")
×
98
        return tag
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc