aboutsummaryrefslogtreecommitdiff
blob: 2b1e2385a57fb6bcd958758aed440108bb3adffe (plain)
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
from django import forms

from djeuscan.models import Version, ProblemReport


class WorldForm(forms.Form):
    world = forms.FileField()


class PackagesForm(forms.Form):
    packages = forms.CharField(widget=forms.Textarea)


class ProblemReportForm(forms.ModelForm):
    version = forms.ModelChoiceField(queryset=Version.objects.all(),
                                     empty_label="all", required=False)
    message = forms.CharField(
        widget=forms.Textarea(attrs={'cols': 80, 'rows': 15})
    )

    def __init__(self, package, *args, **kwargs):
        super(ProblemReportForm, self).__init__(*args, **kwargs)
        self.fields["version"].queryset = Version.objects.filter(
            package=package
        )

    class Meta:
        model = ProblemReport
        fields = ('version', 'subject', 'message')


class PreferencesForm(forms.Form):
    first_name = forms.CharField(max_length=30, required=False)
    last_name = forms.CharField(max_length=30, required=False)
    email = forms.EmailField()

    feed_upstream_info = forms.BooleanField(required=False,
                                            label="Upstream info")
    feed_portage_info = forms.BooleanField(required=False,
                                           label="Portage info")
    feed_show_adds = forms.BooleanField(required=False,
                                        label="Show version bumps")
    feed_show_removals = forms.BooleanField(required=False,
                                            label="Show version removals")
    feed_ignore_pre = forms.BooleanField(required=False,
                                         label="Ignore unstable releases")
    feed_ignore_pre_if_stable = forms.BooleanField(
        required=False,
        label="Ignore unstable releases if current version is stable"
    )

    email_activated = forms.BooleanField(
        required=False, label="Receive euscan emails"
    )
    email_ignore_pre = forms.BooleanField(
        required=False, label="Ignore unstable releases"
    )
    email_ignore_pre_if_stable = forms.BooleanField(
        required=False,
        label="Ignore unstable releases if current version is stable"
    )