3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-04 17:06:27 +00:00
coope/preferences/forms.py
2018-12-02 16:28:40 +01:00

40 lines
1.4 KiB
Python

from django import forms
from django.core.exceptions import ValidationError
from .models import Cotisation, PaymentMethod, GeneralPreferences
class CotisationForm(forms.ModelForm):
"""
Form to add and edit cotisations
"""
class Meta:
model = Cotisation
fields = "__all__"
class PaymentMethodForm(forms.ModelForm):
"""
Form to add and edit payment methods
"""
class Meta:
model = PaymentMethod
fields = "__all__"
class GeneralPreferencesForm(forms.ModelForm):
"""
Form to edit the general preferences
"""
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'}),
}