Révision a01d85be
Ajouté par Serghei Mihai il y a presque 10 ans
calebasse/actes/models.py | ||
---|---|---|
8 | 8 |
from calebasse.ressources.models import ServiceLinkedAbstractModel |
9 | 9 |
from ..middleware.request import get_request |
10 | 10 |
|
11 |
|
|
12 | 11 |
class ActValidationState(models.Model): |
13 | 12 |
|
14 | 13 |
class Meta: |
... | ... | |
48 | 47 |
act=act,state_name='NON_VALIDE', |
49 | 48 |
author=author, previous_state=None) |
50 | 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 | 51 |
act.save() |
52 | 52 |
return act |
53 | 53 |
|
... | ... | |
201 | 201 |
self.valide = True |
202 | 202 |
else: |
203 | 203 |
self.valide = False |
204 |
get_request().record('act-update', '{obj_id} state changed to {state} by {user} from {ip}', |
|
205 |
obj_id=self.id, state=last_validation_state, user=author) |
|
204 | 206 |
self.save() |
205 | 207 |
|
206 | 208 |
def is_billable(self): |
... | ... | |
223 | 225 |
def save(self, *args, **kwargs): |
224 | 226 |
if self.parent_event and not self.parent_event.canceled: |
225 | 227 |
super(Act, self).save(*args, **kwargs) |
228 |
get_request().record('act-save', '{obj_id} saved by {user} from {ip}', obj_id=self.id) |
|
226 | 229 |
|
227 | 230 |
def duration(self): |
228 | 231 |
'''Return a displayable duration for this field.''' |
... | ... | |
262 | 265 |
pass |
263 | 266 |
return None |
264 | 267 |
|
268 |
def delete(self): |
|
269 |
obj_id = self.id |
|
270 |
super(Act, self).delete() |
|
271 |
get_request().record('act-delete', '{obj_id} deleted by {user} from {ip}', obj_id=obj_id) |
|
272 |
|
|
265 | 273 |
class Meta: |
266 | 274 |
verbose_name = u"Acte" |
267 | 275 |
verbose_name_plural = u"Actes" |
Formats disponibles : Unified diff
logging actions on models with django_journal
Closes #1988