-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathforms.py
More file actions
145 lines (119 loc) · 3.95 KB
/
Copy pathforms.py
File metadata and controls
145 lines (119 loc) · 3.95 KB
1
2
3
4
5
6
7
8
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# FederatedCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/federatedcode for support or download.
# See https://aboutcode.org for more information about AboutCode.org OSS projects.
#
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import Note
from .models import Repository
from .models import Review
class CreateGitRepoForm(forms.ModelForm):
class Meta:
model = Repository
fields = ["url"]
help_texts = {
"url": None,
}
def __init__(self, *args, **kwargs):
super(CreateGitRepoForm, self).__init__(*args, **kwargs)
self.fields["url"].widget.attrs.update(
{"class": "input mb-5", "placeholder": "https://github.com/nexB/vulnerablecode-data"}
)
class CreateNoteForm(forms.ModelForm):
class Meta:
model = Note
fields = ["content"]
def __init__(self, *args, **kwargs):
super(CreateNoteForm, self).__init__(*args, **kwargs)
self.fields["content"].widget.attrs.update(
{"class": "textarea", "placeholder": "Add a note...", "rows": 5}
)
self.fields["content"].label = ""
class ReviewStatusForm(forms.ModelForm):
class Meta:
model = Review
fields = ["status"]
help_texts = {
"status": None,
}
def __init__(self, *args, **kwargs):
super(ReviewStatusForm, self).__init__(*args, **kwargs)
self.fields["status"].widget.attrs.update({"class": "input mb-5"})
class PersonSignUpForm(UserCreationForm):
email = forms.EmailField(max_length=254)
class Meta:
model = User
fields = (
"username",
"email",
"password1",
"password2",
)
class CreateReviewForm(forms.Form):
headline = forms.CharField(
widget=forms.TextInput(
attrs={
"class": "input is-medium title has-text-centered",
"placeholder": "Review Title",
}
)
)
data = forms.CharField(widget=forms.Textarea(attrs={"class": "textarea", "rows": 16}))
filename = forms.CharField(widget=forms.HiddenInput())
class FetchForm(forms.Form):
file_path = forms.CharField(
widget=forms.TextInput(
attrs={
"class": "input",
"placeholder": "alpine/dia/VCID-xxx-xxx-xxx.yaml",
}
)
)
class SubscribePackageForm(forms.Form):
acct = forms.CharField(
label="Subscribe with a remote account:",
widget=forms.TextInput(
attrs={"placeholder": "ziadhany@vulnerablecode.io", "class": "input"}
),
)
class SearchPackageForm(forms.Form):
search = forms.CharField(
required=True,
label=False,
widget=forms.TextInput(
attrs={
"placeholder": "Please enter a valid purl ex: pkg:maven/org.apache.commons/io",
"class": "input is-rounded",
"style": "width: 90%;",
},
),
)
class SearchReviewForm(forms.Form):
search = forms.CharField(
required=True,
label=False,
widget=forms.TextInput(
attrs={
"placeholder": "Please Enter a valid Review Name",
"class": "input is-rounded",
"style": "width: 90%;",
},
),
)
class SearchRepositoryForm(forms.Form):
search = forms.CharField(
required=True,
label=False,
widget=forms.TextInput(
attrs={
"placeholder": "Please Enter a Repository URL ex: https://github.com/nexB/vulnerablecode-data",
"class": "input is-rounded",
"style": "width: 90%;",
},
),
)