Exemplo n.º 1
0
    def post(self, request, *args, **kwargs):
        #add a node
        name = request.POST.get('name', None)
        obj = FrontMenu()
        obj.name = name
        obj.save()
        #add the new to the widgets
        widget_menu = InstalledWidgtes()
        widget_menu.app = Applications.objects.get(name="cms")
        widget_menu.description = name
        widget_menu.name = "menu"
        widget_menu.save()
        #add the related widget
        new_widget_menu = Widget_Menu()
        new_widget_menu.widget = widget_menu
        new_widget_menu.menu_name = name
        new_widget_menu.save()
        messages.success(request,_("Menu Added"))

        return redirect('/admin/backend/menu')