@handle_response_format
@treeio_login_required
def dashboard_widget_arrange(request, panel='left', response_format='html'):
 user = request.user.profile
 if ((panel == 'left') or (not panel)):
  shift = (-100)
 else:
  shift = 100
 if (request.GET and ('id_widget[]' in request.GET)):
  widget_ids = request.GET.getlist('id_widget[]')
  widgets = Widget.objects.filter(user=user, pk__in=widget_ids)
  for widget in widgets:
   if (unicode(widget.id) in widget_ids):
    widget.weight = (shift + widget_ids.index(unicode(widget.id)))
    widget.save()
 return HttpResponseRedirect(reverse('core_dashboard_index'))

@ handle_response_format @ treeio_login_required def dashboard_widget_arrange ( request , panel = 'left' , response_format = 'html' ) : user = request . user . profile if ( ( panel == 'left' ) or ( not panel ) ) : shift = ( - 100 ) else : shift = 100 if ( request . GET and ( 'id_widget[]' in request . GET ) ) : widget_ids = request . GET . getlist ( 'id_widget[]' ) widgets = Widget . objects . filter ( user = user , pk__in = widget_ids ) for widget in widgets : if ( unicode ( widget . id ) in widget_ids ) : widget . weight = ( shift + widget_ids . index ( unicode ( widget . id ) ) ) widget . save ( ) return HttpResponseRedirect ( reverse ( 'core_dashboard_index' ) )
arrange widgets with ajax request .