make workpostpart page working

and make sure foreign key constrain exception is caught.