forms.py 1.01 KB
Newer Older
1
"""The forms defined by the registrations package"""
2
3
4
5
from django import forms
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

Thom Wiggers's avatar
Thom Wiggers committed
6
from .models import Registration, Renewal
7
8
9


class MemberRegistrationForm(forms.ModelForm):
10
    """Form for membership registrations"""
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    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):
30
    """Form for membership renewals"""
31
32
33
34
    class Meta:
        model = Renewal
        fields = '__all__'
        exclude = ['created_at', 'updated_at', 'status', 'remarks']