[1.6.x] Fixed #17519 -- Fixed missing SQL constraints to proxy models.

Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.

Backport of aa830009de from master
[1.6.x] Fixed #18777 -- Localized form fields with as_text/as_hidden

Thanks croldan for the report.

Backport of 893d8de6f5 from master