Revision 266e951c
Added by Jérôme Schneider over 13 years ago
| calebasse/agenda/forms.py | ||
|---|---|---|
|
self.occurrence.start_time = datetime.combine(
|
||
|
self.cleaned_data['date'],
|
||
|
self.cleaned_data['time'])
|
||
|
self.occurrence.end_time = start_datetime + timedelta(
|
||
|
self.occurrence.end_time = self.occurrence.start_time + timedelta(
|
||
|
minutes=self.cleaned_data['duration'])
|
||
|
self.occurrence.save()
|
||
|
patient = self.cleaned_data['patient']
|
||
|
creator = get_request().user
|
||
|
self.instance.title = patient.display_name
|
||
|
self.instance.participants = self.cleaned_data['participants']
|
||
|
self.instance.save()
|
||
|
return self.instance
|
||
|
|
||
|
|
||
| calebasse/agenda/views.py | ||
|---|---|---|
|
from calebasse.actes.validation import (automated_validation,
|
||
|
unlock_all_acts_of_the_day)
|
||
|
|
||
|
from forms import NewAppointmentForm, NewEventForm
|
||
|
from forms import NewAppointmentForm, NewEventForm, UpdateAppointmentForm
|
||
|
|
||
|
def redirect_today(request, service):
|
||
|
'''If not date is given we redirect on the agenda for today'''
|
||
| ... | ... | |
|
kwargs['service'] = self.service
|
||
|
return kwargs
|
||
|
|
||
|
def post(self, *args, **kwargs):
|
||
|
return super(NewAppointmentView, self).post(*args, **kwargs)
|
||
|
|
||
|
class UpdateAppointmentView(UpdateView):
|
||
|
model = EventAct
|
||
|
form_class = NewAppointmentForm
|
||
|
form_class = UpdateAppointmentForm
|
||
|
template_name = 'agenda/nouveau-rdv.html'
|
||
|
success_url = '..'
|
||
|
|
||
| ... | ... | |
|
initial['participants'] = self.object.participants.values_list('id', flat=True)
|
||
|
return initial
|
||
|
|
||
|
# def get_form_kwargs(self):
|
||
|
# kwargs = super(UpdateAppointmentView, self).get_form_kwargs()
|
||
|
# kwargs['service'] = self.service
|
||
|
# return kwargs
|
||
|
|
||
|
# def post(self, *args, **kwargs):
|
||
|
# return super(UpdateAppointmentView, self).post(*args, **kwargs)
|
||
|
def get_form_kwargs(self):
|
||
|
kwargs = super(UpdateAppointmentView, self).get_form_kwargs()
|
||
|
kwargs['occurrence'] = self.occurrence
|
||
|
return kwargs
|
||
|
|
||
|
|
||
|
class NewEventView(CreateView):
|
||
Also available in: Unified diff
Fix #1877 agenda: thsi time appoinment edition works