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/actes/models.py
47 47
                act=act,state_name='NON_VALIDE',
48 48
                author=author, previous_state=None)
49 49
        act.last_validation_state = last_validation_state
50
        get_request().record('new-act','{obj_id} created by {user} from {ip}', obj_id=act.id)
51 50
        act.save()
52 51
        return act
53 52

  
......
225 224
    def save(self, *args, **kwargs):
226 225
        if self.parent_event and not self.parent_event.canceled:
227 226
            super(Act, self).save(*args, **kwargs)
228
            get_request().record('act-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id)
229 227

  
230 228
    def duration(self):
231 229
        '''Return a displayable duration for this field.'''
......
268 266
    def delete(self):
269 267
        obj_id = self.id
270 268
        super(Act, self).delete()
271
        get_request().record('act-delete', '{obj_id} deleted by {user} from {ip}', obj_id=obj_id)
272 269

  
273 270
    class Meta:
274 271
        verbose_name = u"Acte"

Also available in: Unified diff