|
1
|
|
|
# coding: utf-8 |
|
2
|
|
|
from dj_diabetes.models.appointments import Appointments |
|
3
|
|
|
|
|
4
|
|
|
from django import forms |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
class AppointmentsForm(forms.ModelForm): |
|
8
|
|
|
""" |
|
9
|
|
|
Appointments Form |
|
10
|
|
|
""" |
|
11
|
|
|
# to " suit " the HTML textearea |
|
12
|
|
|
title = forms.CharField(widget=forms.TextInput( |
|
13
|
|
|
attrs={'class': 'form-control'})) |
|
14
|
|
|
body = forms.CharField(widget=forms.Textarea( |
|
15
|
|
|
attrs={'class': 'form-control', 'rows': '3'})) |
|
16
|
|
|
recall_one_duration = forms.IntegerField(widget=forms.TextInput( |
|
17
|
|
|
attrs={'class': 'form-control', 'type': 'number'})) |
|
18
|
|
|
recall_two_duration = forms.IntegerField(widget=forms.TextInput( |
|
19
|
|
|
attrs={'class': 'form-control', 'type': 'number'})) |
|
20
|
|
|
recall_one_unit = forms.IntegerField(widget=forms.TextInput( |
|
21
|
|
|
attrs={'class': 'form-control', 'type': 'number'})) |
|
22
|
|
|
recall_two_unit = forms.IntegerField(widget=forms.TextInput( |
|
23
|
|
|
attrs={'class': 'form-control', 'type': 'number'})) |
|
24
|
|
|
date_appointments = forms.DateField(widget=forms.TextInput( |
|
25
|
|
|
{'class': 'form-control'})) |
|
26
|
|
|
hour_appointments = forms.TimeField(widget=forms.TextInput( |
|
27
|
|
|
{'class': 'form-control'})) |
|
28
|
|
|
|
|
29
|
|
|
class Meta: |
|
30
|
|
|
model = Appointments |
|
31
|
|
|
fields = ['appointment_types', 'title', 'body', |
|
32
|
|
|
'date_appointments', 'hour_appointments', |
|
33
|
|
|
'recall_one_duration', 'recall_two_duration', |
|
34
|
|
|
'recall_one_unit', 'recall_two_unit'] |
|
35
|
|
|
|
|
36
|
|
|
def __init__(self, *args, **kwargs): |
|
37
|
|
|
super(AppointmentsForm, self).__init__(*args, **kwargs) |
|
38
|
|
|
self.fields['appointment_types'].widget.attrs['class'] = 'form-control' |
|
39
|
|
|
|