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


Python Comment.post_id方法代码示例

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


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

示例1: create_data

# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import post_id [as 别名]

#.........这里部分代码省略.........
    token = Token(bola.id)
    db.session.commit()

    facebook_id3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
    bolovo = User()
    bolovo.name = 'Doutor Bolovo'
    bolovo.facebook_id = facebook_id3
    bolovo.birthday = date.today()
    bolovo.friends = 23
    bolovo.gender = 'male'
    bolovo.nickname = 'bolovo'
    bolovo.email = '[email protected]'
    db.session.add(bolovo)
    token = Token(bolovo.id)
    db.session.commit()

    #create some groups
    share_t = Group()
    share_t.active = True
    share_t.title = "Share Your Thoughts"
    share_t.description = "Grupo copiado do facebook chamado share-your-thoughts"
    share_t.admins.append(bola)
    share_t.subscriptions.append(bola)
    share_t.subscriptions.append(bolovo)
    share_t.subscriptions.append(rafael)
    db.session.add(share_t)
    db.session.commit()

    shammu = Group()
    shammu.active = True
    shammu.title = "Salvem as Baleias!"
    shammu.description = "Grupo dedicado ao salvamento de baleias e o fechamentos de parques de entretenimento que usam animais em cativeiro para estrelar em suas atracoes"
    shammu.admins.append(bola)
    shammu.subscriptions.append(bolovo)
    shammu.subscriptions.append(bola)
    db.session.add(shammu)
    db.session.commit()

    share_c = Group()
    share_c.active = True
    share_c.title = "Share Your Career"
    share_c.description = "Grupo dedicado ao compartilhamento de informacoes sobre estagios, empregos e carreiras em geral"
    share_c.admins.append(bolovo)
    share_c.subscriptions.append(bolovo)
    share_c.subscriptions.append(rafael)
    share_c.subscriptions.append(bola)
    db.session.add(share_c)
    db.session.commit()

    #create some posts to share_t
    share_t_post1 = Post('E possivel a contratacao de anoes para animar festar de criancas acima de 11 anos?', 0)
    share_t_post1.group_id = bola.id
    share_t_post1.user_id = share_t.id
    db.session.add(share_t_post1)
    db.session.commit()

    share_t_post2 = Post('Algo para fazer esse fds??? Geoconda ta com nada me disseram migas!', 0)
    share_t_post2.group_id = bolovo.id
    share_t_post2.user_id = share_t.id
    db.session.add(share_t_post2)
    db.session.commit()

    #create some posts to share_t
    share_c_post1 = Post('[PUC][FACULDADE] Puc ou mackenzie!!!??', 0)
    share_c_post1.group_id = bolovo.id
    share_c_post1.user_id = share_c.id
    db.session.add(share_c_post1)
    db.session.commit()

    share_c_post2 = Post('[EMPREGO][ENTREVISTA] Como e fazer uma entrevista no JPMorgan gente?', 0)
    share_c_post2.group_id = bolovo.id
    share_c_post2.user_id = share_c.id
    db.session.add(share_c_post2)
    db.session.commit()

    #create some posts to shammu
    shammu_post1 = Post('O seaworld realmente acabou ou o boato vem do cu do desentendido?', 0)
    shammu_post1.group_id = bola.id
    shammu_post1.user_id = shammu.id
    db.session.add(shammu_post1)
    db.session.commit()

    #create comments
    share_t_post1_comment = Comment('Obvio que sim querido, anoes sao para todos!')
    share_t_post1_comment.user_id = bolovo.id
    share_t_post1_comment.post_id = share_t_post1.id
    db.session.add(share_t_post1_comment)
    db.session.commit()

    #create rules
    only_woman = Rule('gender', RuleOperands.OPERAND_EQUAL, 'female', 'str', shammu)
    shammu.rules.append(only_woman)
    db.session.add(only_woman)
    db.session.commit()

        #create rules
    only_male = Rule('gender', RuleOperands.OPERAND_EQUAL, 'male', 'str', shammu)
    share_c.rules.append(only_male)
    db.session.add(only_male)
    db.session.commit()
开发者ID:rafagonc,项目名称:share,代码行数:104,代码来源:data_simuator.py


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