def get_widgets(request):
 widgets = {}
 widgets.update(WIDGETS)
 try:
  agent = request.user.profile.serviceagent_set.all()[0]
 except Exception:
  agent = None
 if (not agent):
  del widgets['widget_index_assigned']
 return widgets

def get_widgets ( request ) : widgets = { } widgets . update ( WIDGETS ) try : agent = request . user . profile . serviceagent_set . all ( ) [ 0 ] except Exception : agent = None if ( not agent ) : del widgets [ 'widget_index_assigned' ] return widgets
returns a set of all available widgets .