@filter_hook
def get_init_widget(self):
    portal = []
    widgets = self.widgets
    for col in widgets:
        portal_col = []
        for opts in col:
            try:
                widget = UserWidget(user=self.user, page_id=self.get_page_id(), widget_type=opts['type'])
                widget.set_value(opts)
                widget.save()
                portal_col.append(self.get_widget(widget))
            except (PermissionDenied, WidgetDataError):
                widget.delete()
                continue
        portal.append(portal_col)
    UserSettings(user=self.user, key=('dashboard:%s:pos' % self.get_page_id()), value='|'.join([','.join([str(w.id) for w in col]) for col in portal])).save()
    return portal
@filter_hook
def get_init_widget(self):
    portal = []
    widgets = self.widgets
    for col in widgets:
        portal_col = []
        for opts in col:
            try:
                widget = UserWidget(user=self.user, page_id=self.get_page_id(), widget_type=opts['type'])
                widget.set_value(opts)
                widget.save()
                portal_col.append(self.get_widget(widget))
            except (PermissionDenied, WidgetDataError):
                widget.delete()
                continue
        portal.append(portal_col)
    UserSettings(user=self.user, key=('dashboard:%s:pos' % self.get_page_id()), value='|'.join([','.join([str(w.id) for w in col]) for col in portal])).save()
    return portal