Révision a01d85be
Ajouté par Serghei Mihai il y a presque 10 ans
calebasse/dossiers/models.py | ||
---|---|---|
20 | 20 |
NamedAbstractModel) |
21 | 21 |
from calebasse.actes.models import Act |
22 | 22 |
|
23 |
from ..middleware.request import get_request |
|
24 |
|
|
23 | 25 |
DEFAULT_ACT_NUMBER_DIAGNOSTIC = 6 |
24 | 26 |
DEFAULT_ACT_NUMBER_TREATMENT = 30 |
25 | 27 |
DEFAULT_ACT_NUMBER_PROLONGATION = 10 |
... | ... | |
237 | 239 |
datetime(self.date_selected.year, |
238 | 240 |
self.date_selected.month, self.date_selected.day) |
239 | 241 |
super(FileState, self).save(**kwargs) |
242 |
get_request().record('filestate-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id) |
|
240 | 243 |
|
241 | 244 |
def __unicode__(self): |
242 | 245 |
return self.status.name + ' ' + str(self.date_selected) |
... | ... | |
249 | 252 |
if self.patient.last_state == self: |
250 | 253 |
self.patient.last_state = self.previous_state |
251 | 254 |
self.patient.save() |
255 |
obj_id = self.id |
|
252 | 256 |
super(FileState, self).delete(*args, **kwargs) |
257 |
get_request().record('filestate-delete', '{obj_id} deleted by {user} from {ip}', |
|
258 |
obj_id=obj_id) |
|
253 | 259 |
|
254 | 260 |
class PatientAddress(models.Model): |
255 | 261 |
|
... | ... | |
291 | 297 |
if self.city: |
292 | 298 |
self.display_name += self.city + ' ' |
293 | 299 |
super(PatientAddress, self).save(**kwargs) |
300 |
get_request().record('patientaddress-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id) |
|
294 | 301 |
|
295 | 302 |
class PatientContact(People): |
296 | 303 |
class Meta: |
... | ... | |
569 | 576 |
if not getattr(self, 'service', None): |
570 | 577 |
raise Exception('The field service is mandatory.') |
571 | 578 |
super(PatientRecord, self).save(*args, **kwargs) |
579 |
get_request().record('patientrecord-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id) |
|
572 | 580 |
|
573 | 581 |
def get_state(self): |
574 | 582 |
return self.last_state |
... | ... | |
626 | 634 |
|
627 | 635 |
def delete(self, *args, **kwargs): |
628 | 636 |
if self.can_be_deleted(): |
637 |
obj_id = self.id |
|
629 | 638 |
super(PatientRecord, self).delete(*args, **kwargs) |
639 |
get_request().record('patientrecord-delete', '{obj_id} by {user} from {ip}', obj_id=obj_id) |
|
630 | 640 |
|
631 | 641 |
def get_ondisk_directory(self, service): |
632 | 642 |
if not settings.PATIENT_FILES_BASE_DIRECTORY: |
... | ... | |
1015 | 1025 |
patient.save() |
1016 | 1026 |
patient.policyholder = patient.patientcontact |
1017 | 1027 |
patient.save() |
1028 |
get_request().record('new-patient', '{first_name} {last_name} ({id}) created by {user} from {ip}', |
|
1029 |
first_name=patient.first_name, last_name=patient.last_name, id=patient.id) |
|
1018 | 1030 |
return patient |
Formats disponibles : Unified diff
logging actions on models with django_journal
Closes #1988