LUN-66 - refactored middleware ... same functionality found for Smart Snippets in cms_plugins.py, formfield_for_foreignkey