Manage foreign keys.

Display form for foreign key when add or edit etity record #12.
Better determine template names.