27 lines
892 B
Python
27 lines
892 B
Python
from django import forms
|
|
from .models import Period
|
|
|
|
class AttendanceUpdateForm(forms.Form):
|
|
qr_string = forms.CharField(
|
|
label='Scan QR code',
|
|
max_length=100,
|
|
widget=forms.TextInput(attrs={'autofocus': True})
|
|
)
|
|
|
|
class PeriodForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Period
|
|
fields = ['student', 'station_number', 'clocked_in', 'clocked_out']
|
|
widgets = {
|
|
'clocked_in': forms.DateTimeInput(format = '%Y-%m-%d %H:%M', attrs = {
|
|
'placeholder': '2006-10-25 14:30'
|
|
}),
|
|
'clocked_out': forms.DateTimeInput(format = '%Y-%m-%d %H:%M', attrs = {
|
|
'placeholder': '2006-10-25 14:30'
|
|
}),
|
|
}
|
|
labels = {
|
|
'clocked_in': 'Clocked in (example 2006-10-25 14:30):',
|
|
'clocked_out': 'Clocked out (example 2006-10-25 14:30):',
|
|
}
|