def _create_widget_object(request, module_name, widget_name):
 user = request.user.profile
 perspective = user.get_perspective()
 modules = perspective.get_modules()
 obj = None
 current_module = modules.filter(name=module_name)
 widget = None
 if current_module:
  current_module = current_module[0]
  widget = _get_widget(request, current_module, widget_name)
 if widget:
  obj = Widget(user=user, perspective=perspective)
  obj.module_name = widget['module_name']
  obj.widget_name = widget_name
  obj.save()
 return obj

def _create_widget_object ( request , module_name , widget_name ) : user = request . user . profile perspective = user . get_perspective ( ) modules = perspective . get_modules ( ) obj = None current_module = modules . filter ( name = module_name ) widget = None if current_module : current_module = current_module [ 0 ] widget = _get_widget ( request , current_module , widget_name ) if widget : obj = Widget ( user = user , perspective = perspective ) obj . module_name = widget [ 'module_name' ] obj . widget_name = widget_name obj . save ( ) return obj
create a widget object if one is available for the current user perspective .