equal
deleted
inserted
replaced
2 ''' |
2 ''' |
3 Created on Feb 22, 2015 |
3 Created on Feb 22, 2015 |
4 |
4 |
5 @author: ymh |
5 @author: ymh |
6 ''' |
6 ''' |
|
7 import logging |
|
8 |
7 from django.db import transaction |
9 from django.db import transaction |
|
10 |
8 from hdalab.models.renkan import HdalabRenkanStateTransition |
11 from hdalab.models.renkan import HdalabRenkanStateTransition |
|
12 |
|
13 |
|
14 logger = logging.getLogger(__name__) |
9 |
15 |
10 @transaction.atomic |
16 @transaction.atomic |
11 def change_renkan_state(hda_renkan, state, message=None, author=None): |
17 def change_renkan_state(hda_renkan, state, message=None, author=None): |
12 |
18 |
13 if state != hda_renkan.state: |
19 if state != hda_renkan.state: |
14 |
20 |
15 HdalabRenkanStateTransition.objects.create(renkan=hda_renkan, from_state=hda_renkan.state, to_state=state, message=message, author=author) |
21 HdalabRenkanStateTransition.objects.create(renkan=hda_renkan, from_state=hda_renkan.state, to_state=state, message=message, author=author) |
16 hda_renkan.state = state |
22 hda_renkan.state = state |
17 hda_renkan.save() |
23 hda_renkan.save() |
|
24 |