Replace StandardError exception by Exception

StandardError is deprecated in python 3.x. Exception should be used instead.
Use pk instead of id