1 from view_common import *
3 class DashboardCustomize(View):
4 def post(self, request, *args, **kwargs):
\r
5 if request.user.isReadOnlyUser():
\r
6 return HttpResponseForbidden("User is in read-only mode")
\r
8 dashboards = request.POST.get("dashboards", None)
\r
12 dashboards = [x.strip() for x in dashboards.split(",")]
\r
13 dashboards = [DashboardView.objects.get(name=x) for x in dashboards]
\r
15 request.user.userdashboardviews.all().delete()
\r
17 for i,dashboard in enumerate(dashboards):
\r
18 udbv = UserDashboardView(user=request.user, dashboardView=dashboard, order=i)
\r
21 return HttpResponse(json.dumps("Success"), content_type='application/javascript')