def validate_state(self, value):
    if ((value is not None) and (value != self.context['created_by'].state) and (not self.context['created_by'].is_superuser)):
        raise serializers.ValidationError('Cannot create for a different state')
    return value
def validate_state(self, value):
    if ((value is not None) and (value != self.context['created_by'].state) and (not self.context['created_by'].is_superuser)):
        raise serializers.ValidationError('Cannot create for a different state')
    return value