Revision 95593005
Added by Serghei Mihai over 11 years ago
| calebasse/cbv.py | ||
|---|---|---|
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from datetime import datetime, date
|
||
|
from dateutil.relativedelta import relativedelta
|
||
|
|
||
| ... | ... | |
|
from django.http import Http404, HttpResponseRedirect
|
||
|
from django.core.urlresolvers import resolve
|
||
|
from django.core.exceptions import ImproperlyConfigured
|
||
|
from django.contrib import messages
|
||
|
|
||
|
from calebasse.ressources.models import Service
|
||
|
from calebasse.middleware.request import get_request
|
||
| ... | ... | |
|
|
||
|
HOME_SERVICE_COOKIE = 'home-service'
|
||
|
|
||
|
class NotificationDisplayView(object):
|
||
|
|
||
|
def form_valid(self, form):
|
||
|
valid = super(NotificationDisplayView, self).form_valid(form)
|
||
|
messages.info(self.request, u'Modification enregistrée avec succès')
|
||
|
return valid
|
||
|
|
||
|
class ReturnToObjectMixin(object):
|
||
|
def get_success_url(self):
|
||
|
return '../#object-' + str(self.object.pk)
|
||
| calebasse/dossiers/views.py | ||
|---|---|---|
|
|
||
|
new_patient_contact = NewPatientContactView.as_view()
|
||
|
|
||
|
class UpdatePatientContactView(RecordPatientRecordIdMixing, cbv.UpdateView):
|
||
|
class UpdatePatientContactView(RecordPatientRecordIdMixing, cbv.NotificationDisplayView, cbv.UpdateView):
|
||
|
model = PatientContact
|
||
|
form_class = forms.PatientContactForm
|
||
|
template_name = 'dossiers/patientcontact_new.html'
|
||
|
success_url = '../../view#tab=2'
|
||
|
|
||
|
def form_valid(self, form):
|
||
|
valid = super(UpdatePatientContactView, self).form_valid(form)
|
||
|
messages.info(self.request, u'Modification enregistrée avec succès')
|
||
|
return valid
|
||
|
|
||
|
update_patient_contact = UpdatePatientContactView.as_view()
|
||
|
|
||
|
class DeletePatientContactView(cbv.DeleteView):
|
||
| ... | ... | |
|
|
||
|
new_patient_address = NewPatientAddressView.as_view()
|
||
|
|
||
|
class UpdatePatientAddressView(cbv.UpdateView):
|
||
|
class UpdatePatientAddressView(cbv.NotificationDisplayView, cbv.UpdateView):
|
||
|
model = PatientAddress
|
||
|
form_class = forms.PatientAddressForm
|
||
|
template_name = 'dossiers/patientaddress_new.html'
|
||
|
success_url = '../../view#tab=2'
|
||
|
|
||
|
def form_valid(self, form):
|
||
|
messages.add_message(self.request,
|
||
|
messages.INFO,
|
||
|
u'Modification enregistrée avec succès.')
|
||
|
return super(UpdatePatientAddressView, self).form_valid(form)
|
||
|
|
||
|
update_patient_address = UpdatePatientAddressView.as_view()
|
||
|
|
||
|
class DeletePatientAddressView(cbv.DeleteView):
|
||
| ... | ... | |
|
|
||
|
tab2_fiche_adm = PatientRecordAdmView.as_view()
|
||
|
|
||
|
class PatientRecordAddrView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
|
||
|
class PatientRecordAddrView(cbv.ServiceViewMixin, cbv.NotificationDisplayView, cbv.MultiUpdateView):
|
||
|
model = PatientRecord
|
||
|
forms_classes = {
|
||
|
'contact': forms.PatientContactForm,
|
||
Also available in: Unified diff
dossiers: display notification on patient record contacts and addresses update
Closes #4807