| 123456789101112131415161718192021222324 |
- from django import forms
- from models import Application, Review
- COURSE_CHOICES =[
- ("курс 1", "Курс 1"),
- ("курс 2", "Курс 2"),
- ("курс 3", "Курс 3")
- ]
- class ApplicationForm(forms.ModelForm):
- course_name = forms.CharField(label="Название курса", choices=COURSE_CHOICES, widget=forms.Select(attrs={"class": "form-control"}))
- payment_method = forms.CharField(label="Способ оплаты", choices=Application.PAYMENT_CHOICES, widget=forms.Select(attrs={"class": "form-control"}))
- date_start = forms.DateField(label="Дата старта обучения", widget=forms.TextInput(attrs={"class": "form-control", "placeholder": "ДД.ММ.ГГГГ"}))
- class Meta:
- model = Application
- fields = ["course_name", "pyment_method", "date_start", ]
- class ReviewForm(forms.ModelForm):
- text = forms.CharField(label="Отзыв", widget=forms.Textarea(attrs={"class": "form-control", "rows": 5, "placeholder": "Введите текст отзыва"}))
- class Meta:
- model = Review
- fields = ["text", ]
|