code: def register_widgets():
      
  
      # special case
      # register external apps
      Page.create_content_type(
          ApplicationWidget, APPLICATIONS=settings.APPLICATION_CHOICES)
  
      for _optgroup, _widgets in six.iteritems(settings.WIDGETS):
          optgroup = _optgroup if _optgroup != 'ungrouped' else None
          for widget in _widgets:
  
              kwargs = {'optgroup': optgroup}
  
              # load class from strings
              if isinstance(widget, six.string_types):
                  try:
                      WidgetCls = get_class_from_string(widget)
                  except:
                      exc_info = sys.exc_info()
                      raise six.reraise(*exc_info)
              elif isinstance(widget, tuple):
                  try:
                      WidgetCls = get_class_from_string(widget[0])
                      if len(widget) > 1:
                          kwargs.update(widget[1])
                  except Exception as e:
                      raise Exception('%s: %s' % (mod, e))
              else:
                  WidgetCls = widget
  
              Page.create_content_type(
                  WidgetCls, **kwargs)
docs: Register all collected widgets from settings
      WIDGETS = [('mymodule.models.MyWidget', {'mykwargs': 'mykwarg'})]
      WIDGETS = ['mymodule.models.MyWidget', MyClass]