本文整理汇总了Python中model_mommy.recipe.Recipe.extend方法的典型用法代码示例。如果您正苦于以下问题:Python Recipe.extend方法的具体用法?Python Recipe.extend怎么用?Python Recipe.extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model_mommy.recipe.Recipe
的用法示例。
在下文中一共展示了Recipe.extend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Recipe
# 需要导入模块: from model_mommy.recipe import Recipe [as 别名]
# 或者: from model_mommy.recipe.Recipe import extend [as 别名]
dog = Recipe(Dog,
breed = 'Pug',
owner = foreign_key(person)
)
homeless_dog = Recipe(Dog,
breed = 'Pug',
)
other_dog = Recipe(Dog,
breed = 'Basset',
owner = foreign_key('person')
)
dog_with_friends = dog.extend(
friends_with=related(dog, dog),
)
dog_with_more_friends = dog.extend(
friends_with=related(dog_with_friends),
)
extended_dog = dog.extend(
breed = 'Super basset',
)
other_dog_unicode = Recipe(Dog,
breed = 'Basset',
owner = foreign_key(u('person'))
)