'''
Created on Apr 10, 2013

@author: egiraldo
'''
from django.forms import widgets
from rest_framework import serializers
from workflow_transaccion.models import Workflow_Transaccion
class WorkflowTransaccionSerializer(serializers.Serializer):
    id_workflow_transaccion = serializers.Field()  # Note: `Field` is an untyped read-only field.
    id_workflow = serializers.Field()  # Note: `Field` is an untyped read-only field.
    id_transaccion = serializers.Field()  # Note: `Field` is an untyped read-only field.
    def restore_object(self, attrs, instance=None):
        if instance:
            # Update existing instance
            instance.id_workflow = attrs.get('id_workflow', instance.id_workflow)
            instance.id_transaccion = attrs.get('id_transaccion', instance.id_transaccion)
            return instance
        # Create new instance
        return Workflow_Transaccion(**attrs)
