当前位置: 首页>>代码示例>>Python>>正文


Python Node.get_node_choices方法代码示例

本文整理汇总了Python中models.Node.get_node_choices方法的典型用法代码示例。如果您正苦于以下问题:Python Node.get_node_choices方法的具体用法?Python Node.get_node_choices怎么用?Python Node.get_node_choices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Node的用法示例。


在下文中一共展示了Node.get_node_choices方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def post(self, urlname):
     if not self.has_permission:
         return
     if not self.current_user.is_admin:
         return self.redirect_next_url()
     node = Node.get(urlname=urlname)
     if not node:
         return self.redirect_next_url()
     user = self.current_user
     args = self.request.arguments
     try:
         selected = args.get('parent_name')
         print(selected)
     except:
         selected = [n.name for n in node.parent_nodes]
         args = {'name': [node.name], 'urlname': [node.urlname],
                 'description': [node.description], 'style': [node.style]}
     form = NodeEditForm.init(Node.get_node_choices(), selected, args=args,
             node=node)
     if form.validate():
         node = form.save(user, node=node)
         result = {'status': 'success', 'message': '节点修改成功',
                 'node_url': node.url}
         if self.is_ajax:
             return self.write(result)
         self.flash_message(result)
         return self.redirect(node.url)
     if self.is_ajax:
         return self.write(form.result)
     return self.render("node/edit.html", form=form, node=node)
开发者ID:KeenTurbo,项目名称:collipa,代码行数:32,代码来源:node.py

示例2: get

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def get(self):
     node_id = int(self.get_argument('node_id', 0))
     node = Node.get(id=node_id)
     if node:
         selected = [node.name]
     else:
         selected = []
     form = NodeForm.init(Node.get_node_choices(), selected)
     return self.render("node/create.html", form=form)
开发者ID:ljtyzhr,项目名称:collipa,代码行数:11,代码来源:node.py

示例3: get

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def get(self):
     node_id = force_int(self.get_argument('node_id', 0), 0)
     node = Node.get(id=node_id)
     if node:
         selected = node.name
     else:
         selected = None
     choices = Node.get_node_choices()
     form = TopicForm.init(choices=choices, selected=selected)
     return self.render("topic/create.html", form=form, node=node)
开发者ID:ljtyzhr,项目名称:collipa,代码行数:12,代码来源:topic.py

示例4: get

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def get(self, topic_id):
     topic = Topic.get(id=topic_id)
     if topic and (topic.author == self.current_user or self.current_user.is_admin):
         selected = topic.node.name
     else:
         return self.redirect_next_url()
     choices = Node.get_node_choices()
     args = {'node_name': [selected], 'title': [topic.title], 'content':
             [topic.content]}
     form = TopicForm.init(choices=choices, selected=selected, args=args)
     return self.render("topic/create.html", form=form, node=topic.node)
开发者ID:ClayMoreBoy,项目名称:collipa,代码行数:13,代码来源:topic.py

示例5: get

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def get(self):
     if not self.has_permission:
         return
     if not self.current_user.is_admin:
         return self.redirect_next_url()
     node_id = int(self.get_argument('node_id', 0))
     node = Node.get(id=node_id)
     if node:
         selected = [node.name]
     else:
         selected = []
     form = NodeForm.init(Node.get_node_choices(), selected)
     return self.render("node/create.html", form=form)
开发者ID:KeenTurbo,项目名称:collipa,代码行数:15,代码来源:node.py

示例6: get

# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import get_node_choices [as 别名]
 def get(self, topic_id):
     if not self.has_permission:
         return
     topic = Topic.get(id=topic_id)
     if topic:
         selected = topic.node.name
     else:
         return self.redirect_next_url()
     choices = Node.get_node_choices()
     args = {'node_name': [selected], 'title': [topic.title], 'content':
             [topic.content]}
     form = TopicForm.init(choices=choices, selected=selected, args=args)
     return self.render("topic/create.html", form=form, node=topic.node)
开发者ID:SunnyKale,项目名称:collipa,代码行数:15,代码来源:topic.py


注:本文中的models.Node.get_node_choices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。