Project

General

Profile

« Previous | Next » 

Revision 8e6a3c86

Added by Serghei Mihai over 9 years ago

logging actions on models improved using post_save and pre_delete signals

View differences:

calebasse/agenda/models.py
360 360
        assert self.start_datetime is not None
361 361
        self.sanitize() # init periodicity fields
362 362
        super(Event, self).save(*args, **kwargs)
363
        get_request().record('event-save', '{obj_id} saved by {user} from {ip}',
364
                             obj_id=self.id)
365 363
        self.acts_cleaning()
366 364

  
367 365
    def delete(self, *args, **kwargs):
......
538 536
    def update_act(self, act):
539 537
        '''Update an act to match details of the meeting'''
540 538
        self.init_act(act)
541
        changes = {'delta': self.timedelta(), 'act_type': self.act_type,
542
                   'patient': self.patient, 'date': self.start_datetime.date(),
543
                   'time': self.start_datetime.time(), 'parent': self}
544
        get_request().record('act-update', '{obj_id} updated by {user} from {ip} with: {changes}', changes=changes)
545 539
        act.save()
546 540

  
547 541
    def init_act(self, act):
......
558 552
        '''Force event_type to be patient meeting.'''
559 553
        self.event_type = EventType(id=1)
560 554
        super(EventWithAct, self).save(*args, **kwargs)
561
        get_request().record('eventwithact-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id)
562 555

  
563 556
    def is_event_absence(self):
564 557
        return self.act.is_absent()

Also available in: Unified diff