diff -r 1121fd3d8b0e -r 604b887e70c3 src/hdalab/services.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdalab/services.py Thu Feb 26 10:33:10 2015 +0100 @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +''' +Created on Feb 22, 2015 + +@author: ymh +''' +from django.db import transaction +from hdalab.models.renkan import HdalabRenkanStateTransition + +@transaction.atomic +def change_renkan_state(hda_renkan, state, message=None, author=None): + + if state != hda_renkan.state: + + HdalabRenkanStateTransition.objects.create(renkan=hda_renkan, from_state=hda_renkan.state, to_state=state, message=message, author=author) + hda_renkan.state = state + hda_renkan.save() \ No newline at end of file