forms.py 902 Bytes
Newer Older
1
2
3
4
from django import forms
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

Thom Wiggers's avatar
Thom Wiggers committed
5
from .models import Registration, Renewal
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


class MemberRegistrationForm(forms.ModelForm):
    birthday = forms.DateField(
        widget=forms.widgets.SelectDateWidget(years=[
            year for year in range(timezone.now().year - 50,
                                   timezone.now().year - 10)]),
        label=_('birthday')
    )

    privacy_policy = forms.BooleanField(
        required=True,
        label=_('I accept the privacy policy')
    )

    class Meta:
        model = Registration
        fields = '__all__'
        exclude = ['created_at', 'updated_at', 'status', 'username', 'remarks']


class MemberRenewalForm(forms.ModelForm):
    class Meta:
        model = Renewal
        fields = '__all__'
        exclude = ['created_at', 'updated_at', 'status', 'remarks']