code: def _create_relational_field(self, attr, options):
          
          options['entity_class'] = attr.py_type
          options['allow_empty'] = not attr.is_required
          return EntityField, options
docs: Creates the form element for working with entity relationships.