#NEWLINE# def _create_users_and_articles( self ) : #NEWLINE# #INDENT# self . user1 = get_user_model ( ) . objects . create ( username = 'user1' ) #NEWLINE# self . user2 = get_user_model ( ) . objects . create ( username = 'user2' ) #NEWLINE# self . user3 = get_user_model ( ) . objects . create ( username = 'user3' ) #NEWLINE# self . superuser = get_user_model ( ) . objects . create ( username = 'superuser' , is_superuser = True ) #NEWLINE# content_types = [ ContentType . objects . get_for_model ( m ) for m in ( Article , LongArticle , Library ) ] #NEWLINE# base_permissions = Permission . objects . filter ( content_type__in = content_types ) #NEWLINE# for user in ( self . user1 , self . user2 , self . user3 ) : #NEWLINE# #INDENT# user . user_permissions . add ( * base_permissions ) #NEWLINE# #UNINDENT# self . user1 . user_permissions . remove ( Permission . objects . get ( content_type = ContentType . objects . get_for_model ( Article ) , codename = 'change_article_custom_field_1_field' ) ) #NEWLINE# self . user1 . user_permissions . remove ( Permission . objects . get ( content_type = ContentType . objects . get_for_model ( Article ) , codename = 'view_article_custom_field_1_field' ) ) #NEWLINE# self . user3 . user_permissions . remove ( Permission . objects . get ( content_type = ContentType . objects . get_for_model ( Article ) , codename = 'change_article_custom_field_1_field' ) ) #NEWLINE# self . article_1 = Article . objects . create ( author = self . user1 , title = '1' , content = ( '1' * 10 ) , custom_field_1 = 'test value' ) #NEWLINE# self . article_2 = Article . objects . create ( author = self . user2 , title = '2' , content = ( '2' * 10 ) ) #NEWLINE# self . article_3 = Article . objects . create ( author = self . user3 , title = '3' , content = ( '3' * 10 ) , custom_field_1 = 'test value 2' ) #NEWLINE# self . article_1 . collaborators . add ( self . user2 ) #NEWLINE# self . long_article = LongArticle . objects . create ( author = self . user1 , title = '####### long article ########' , content = 'lorem ipsum' , custom_field_1 = 'ipsum lorem' ) #NEWLINE# self . long_article_2 = LongArticle . objects . create ( author = self . user1 , title = 'short' , content = 'lorem ipsum' , custom_field_2 = self . article_1 )