def widget_move(request):
 profile = Profile.objects.get_or_create(user=request.user)[0]
 profile_data = profile.extra_data
 widget_type = request.POST.get(u'type')
 if (widget_type == u'primary'):
  positions_key = u'primary_widget_positions'
  widgets = primary_widgets
 else:
  positions_key = u'secondary_widget_positions'
  widgets = secondary_widgets
 positions = profile_data.setdefault(positions_key, {})
 for widget in widgets:
  widget_position = request.POST.get(widget.widget_id)
  if (widget_position is not None):
   positions[widget.widget_id] = widget_position
  else:
   positions[widget.widget_id] = str(len(widgets))
 profile.save()
 return HttpResponse()

def widget_move ( request ) : profile = Profile . objects . get_or_create ( user = request . user ) [ 0 ] profile_data = profile . extra_data widget_type = request . POST . get ( u'type' ) if ( widget_type == u'primary' ) : positions_key = u'primary_widget_positions' widgets = primary_widgets else : positions_key = u'secondary_widget_positions' widgets = secondary_widgets positions = profile_data . setdefault ( positions_key , { } ) for widget in widgets : widget_position = request . POST . get ( widget . widget_id ) if ( widget_position is not None ) : positions [ widget . widget_id ] = widget_position else : positions [ widget . widget_id ] = str ( len ( widgets ) ) profile . save ( ) return HttpResponse ( )
handle moving of admin widgets .