Revision 2ae5dd3d
Added by Benjamin Dauvergne over 13 years ago
| calebasse/agenda/forms.py | ||
|---|---|---|
|
|
||
|
|
||
|
class UpdateAppointmentForm(NewAppointmentForm):
|
||
|
pass
|
||
|
class Meta(NewAppointmentForm.Meta):
|
||
|
fields = (
|
||
|
'start_datetime',
|
||
|
'date',
|
||
|
'time',
|
||
|
'duration',
|
||
|
'patient',
|
||
|
'participants',
|
||
|
'room',
|
||
|
'act_type',
|
||
|
)
|
||
|
|
||
|
|
||
|
class NewEventForm(forms.ModelForm):
|
||
| ... | ... | |
|
self._errors['title'] = self.error_class([
|
||
|
u"Ce champ est obligatoire pour les événements de type « Autre »."])
|
||
|
return cleaned_data
|
||
|
|
||
|
|
||
|
class UpdateEventForm(NewEventForm):
|
||
|
class Meta(NewEventForm.Meta):
|
||
|
fields = (
|
||
|
'start_datetime',
|
||
|
'title',
|
||
|
'date',
|
||
|
'time',
|
||
|
'duration',
|
||
|
'room',
|
||
|
'participants',
|
||
|
'event_type',
|
||
|
'services',
|
||
|
)
|
||
| calebasse/agenda/views.py | ||
|---|---|---|
|
from calebasse.actes.validation import (automated_validation, unlock_all_acts_of_the_day)
|
||
|
from calebasse import cbv
|
||
|
|
||
|
from forms import (NewAppointmentForm, NewEventForm, UpdateAppointmentForm)
|
||
|
from forms import (NewAppointmentForm, NewEventForm, UpdateAppointmentForm, UpdateEventForm)
|
||
|
|
||
|
def redirect_today(request, service):
|
||
|
'''If not date is given we redirect on the agenda for today'''
|
||
| ... | ... | |
|
|
||
|
class UpdateEventView(TodayOccurrenceMixin, UpdateView):
|
||
|
model = Event
|
||
|
form_class = NewEventForm
|
||
|
form_class = UpdateEventForm
|
||
|
template_name = 'agenda/update-event.html'
|
||
|
success_url = '..'
|
||
|
|
||
Also available in: Unified diff
agenda: hide periodicity fields when editing event and appointments