Révision d3cfbd19
Ajouté par Serghei Mihai (congés, retour 15/05) il y a presque 10 ans
calebasse/actes/views.py | ||
---|---|---|
8 | 8 |
|
9 | 9 |
from calebasse.cbv import ListView, UpdateView, DeleteView |
10 | 10 |
from calebasse.agenda.views import NewAppointmentView |
11 |
from calebasse.agenda.models import EventWithAct |
|
12 |
from calebasse.agenda.forms import UpdateAppointmentForm, NewAppointmentForm |
|
11 | 13 |
|
12 | 14 |
import copy |
13 | 15 |
import models |
... | ... | |
77 | 79 |
class NewAct(NewAppointmentView): |
78 | 80 |
success_url = '.' |
79 | 81 |
success_msg = u'Acte enregistré avec succès.' |
82 |
model = EventWithAct |
|
83 |
form_class = UpdateAppointmentForm |
|
80 | 84 |
|
81 | 85 |
def form_valid(self, form): |
82 | 86 |
result = super(NewAct, self).form_valid(form) |
calebasse/agenda/forms.py | ||
---|---|---|
120 | 120 |
appointment.clean() |
121 | 121 |
if commit: |
122 | 122 |
appointment.save() |
123 |
self.save_m2m() |
|
123 | 124 |
appointment.services = [self.service] |
124 | 125 |
return appointment |
125 | 126 |
|
calebasse/agenda/models.py | ||
---|---|---|
515 | 515 |
act.save = old_save |
516 | 516 |
old_save(*args, **kwargs) |
517 | 517 |
act.comment = self.description |
518 |
act.doctors = self.participants.select_subclasses()
|
|
518 |
act.doctors = (participant.worker for participant in self.participants.all())
|
|
519 | 519 |
last_validation_state = ActValidationState.objects.create( |
520 | 520 |
act=act, state_name='NON_VALIDE', |
521 | 521 |
author=self.creator, previous_state=None) |
calebasse/agenda/views.py | ||
---|---|---|
133 | 133 |
return context |
134 | 134 |
|
135 | 135 |
|
136 |
class NewAppointmentView(cbv.ReturnToObjectMixin, cbv.ServiceFormMixin, CreateView):
|
|
136 |
class NewAppointmentView(cbv.ServiceFormMixin, CreateView): |
|
137 | 137 |
model = EventWithAct |
138 | 138 |
form_class = NewAppointmentForm |
139 | 139 |
template_name = 'agenda/new-appointment.html' |
... | ... | |
150 | 150 |
initial['duration'] = self.request.GET.get('duration') |
151 | 151 |
return initial |
152 | 152 |
|
153 |
def get_form_kwargs(self): |
|
154 |
kwargs = super(NewAppointmentView, self).get_form_kwargs() |
|
155 |
kwargs['service'] = self.service |
|
156 |
return kwargs |
|
157 |
|
|
158 | 153 |
def get_success_url(self): |
159 | 154 |
return self.request.META.get('HTTP_REFERER', '..') |
160 | 155 |
|
161 | 156 |
def form_valid(self, form): |
157 |
obj = super(NewAppointmentView, self).form_valid(form) |
|
162 | 158 |
messages.add_message(self.request, messages.INFO, self.success_msg) |
163 |
return super(NewAppointmentView, self).form_valid(form)
|
|
159 |
return obj
|
|
164 | 160 |
|
165 | 161 |
|
166 | 162 |
class TodayOccurrenceMixin(object): |
Formats disponibles : Unified diff
actes: fixing empty EventWithAct object while trying to create an act. Doctors
are forced to be Worker instances instead of People(which is its parent)
Closes #4945