本文整理汇总了Python中film20.core.models.Film.get_title方法的典型用法代码示例。如果您正苦于以下问题:Python Film.get_title方法的具体用法?Python Film.get_title怎么用?Python Film.get_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类film20.core.models.Film
的用法示例。
在下文中一共展示了Film.get_title方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PostTestCase
# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_title [as 别名]
#.........这里部分代码省略.........
post2 = Post()
post2.title = "third post"
post2.permalink = "third-post"
post2.body = "post third post"
post2.user = self.u1
post2.status = Post.PUBLIC_STATUS
post2.type = Post.TYPE_POST
post2.featured_note = True
post2.save()
post = Post.objects.featured_review()
self.assertEqual(post.permalink, u'third-post')
# change featured post status and check if cache is invalidated
post2 = Post.objects.get(title__iexact='third post')
post2.status = Post.DRAFT_STATUS
post2.save()
post = Post.objects.featured_review()
self.assertEqual(post.permalink, u'second-post')
# republished post
post2 = Post.objects.get(title__iexact='third post')
post2.status = Post.PUBLIC_STATUS
post2.save()
post = Post.objects.featured_review()
self.assertEqual(post.permalink, u'third-post')
self.assertEqual(Post.objects.recent_reviews().count(), 0)
def test_tagging( self ):
"""
test posts tagging
"""
post = Post()
post.title = "Lorem ipsum"
post.permalink = "lorem-ipsum"
post.body = "siala lala tralala"
post.user = self.u1
post.status = Object.PUBLIC_STATUS
post.type = Object.TYPE_POST
post.tag_list = 'ww2,pl,lorem'
post.save()
self.assertEqual( UserActivity.objects.all_notes().tagged( 'ww2' ).count(), 1 )
def test_related_movies( self ):
"""
test post related movies
"""
self.assertEqual( Post.objects.count(), 0 )
params = {
"title" : "Battlefield review",
"body" : "Lorem ipsum",
"publish" : "1",
"related_film": "Battlefield Earth II [2010],"
}
self.client.login( username='michuk', password='secret' )
response = self.client.post( reverse( 'new_article' ), params, follow=True )
self.assertEqual( response.status_code, 200 )
self.assertEqual( Post.objects.count(), 1 )
post = Post.objects.all()[0]
self.assertEqual( post.title, params['title'] )
self.assertEqual( post.related_film.count(), 1 )
self.assertEqual( UserActivity.objects.count(), 1 )
act = UserActivity.objects.all()[0]
self.assertFalse( act.film is None )
self.assertEqual( act.film_title, self.film.get_title() )
self.assertEqual( act.film_permalink, self.film.permalink )
# edit article
params['related_film'] = ''
response = self.client.post( reverse( 'edit_article', args=[post.pk] ), params, follow=True )
self.assertEqual( response.status_code, 200 )
self.assertEqual( Post.objects.count(), 1 )
post = Post.objects.all()[0]
self.assertEqual( post.related_film.count(), 0 )
self.assertEqual( UserActivity.objects.count(), 1 )
act = UserActivity.objects.all()[0]
self.assertTrue( act.film is None )
self.assertTrue( act.film_title is None )
self.assertTrue( act.film_permalink is None )