2018-10-05 22:03:02 +00:00
|
|
|
from django import forms
|
2018-11-22 21:52:15 +00:00
|
|
|
from django.core.exceptions import ValidationError
|
2018-10-05 22:03:02 +00:00
|
|
|
|
|
|
|
from .models import Cotisation, PaymentMethod, GeneralPreferences
|
|
|
|
|
|
|
|
class CotisationForm(forms.ModelForm):
|
2018-12-02 15:28:40 +00:00
|
|
|
"""
|
|
|
|
Form to add and edit cotisations
|
|
|
|
"""
|
2018-10-05 22:03:02 +00:00
|
|
|
class Meta:
|
|
|
|
model = Cotisation
|
|
|
|
fields = "__all__"
|
|
|
|
|
|
|
|
class PaymentMethodForm(forms.ModelForm):
|
2018-12-02 15:28:40 +00:00
|
|
|
"""
|
|
|
|
Form to add and edit payment methods
|
|
|
|
"""
|
2018-10-05 22:03:02 +00:00
|
|
|
class Meta:
|
|
|
|
model = PaymentMethod
|
|
|
|
fields = "__all__"
|
|
|
|
|
|
|
|
|
|
|
|
class GeneralPreferencesForm(forms.ModelForm):
|
2018-12-02 15:28:40 +00:00
|
|
|
"""
|
|
|
|
Form to edit the general preferences
|
|
|
|
"""
|
2018-10-05 22:03:02 +00:00
|
|
|
class Meta:
|
|
|
|
model = GeneralPreferences
|
|
|
|
fields = "__all__"
|
|
|
|
widgets = {
|
|
|
|
'global_message': forms.Textarea(attrs={'placeholder': 'Message global à afficher sur le site'}),
|
|
|
|
'active_message': forms.Textarea(attrs={'placeholder': 'Ce message s\'affichera si le site n\'est pas actif'}),
|
|
|
|
'president': forms.TextInput(attrs={'placeholder': 'Président'}),
|
|
|
|
'vice_president': forms.TextInput(attrs={'placeholder': 'Vice-président'}),
|
|
|
|
'secretary': forms.TextInput(attrs={'placeholder': 'Secrétaire'}),
|
|
|
|
'treasurer': forms.TextInput(attrs={'placeholder': 'Trésorier'}),
|
|
|
|
'brewer': forms.TextInput(attrs={'placeholder': 'Maître brasseur'}),
|
|
|
|
'grocer': forms.TextInput(attrs={'placeholder': 'Epic épicier'}),
|
|
|
|
}
|
|
|
|
|