示例#1
0
    def groups_to_model(self, groups):
        data = self.prepare_json_from(groups)
        groups = []

        for groupJson in data:
            group = Group()
            group.id = int(groupJson['id'])
            group.name = groupJson['name']
            group.faculty = groupJson['faculty']
            groups.append(group)

        return groups
示例#2
0
  def groups_to_model(self, groups):
    data = self.prepare_json_from(groups)
    groups = []

    for groupJson in data:
      group = Group()
      group.id = int(groupJson['id'])
      group.name = groupJson['name']
      group.faculty = groupJson['faculty']
      groups.append(group)

    return groups
示例#3
0
def create_group(name, label):
    """
    设置用户分组
    :param name:
    :param label:
    :return:
    """
    with db.auto_commit():
        group = Group()
        group.name = name
        group.label = label
        db.session.add(group)
    print("成功创建用户分组:%s " % (name, ))