#NEWLINE# def add_image_permissions_to_admin_groups( apps , schema_editor ) : #NEWLINE# #INDENT# ContentType = apps . get_model ( 'contenttypes.ContentType' ) #NEWLINE# Permission = apps . get_model ( 'auth.Permission' ) #NEWLINE# Group = apps . get_model ( 'auth.Group' ) #NEWLINE# ( image_content_type , _created ) = ContentType . objects . get_or_create ( model = 'image' , app_label = 'wagtailimages' , defaults = ( { #NEWLINE# #INDENT# 'name' : 'image' , #NEWLINE# #UNINDENT# } if ( DJANGO_VERSION < ( 1 , 8 ) ) else { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# ( add_image_permission , _created ) = Permission . objects . get_or_create ( content_type = image_content_type , codename = 'add_image' , defaults = { #NEWLINE# #INDENT# 'name' : 'Can add image' , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( change_image_permission , _created ) = Permission . objects . get_or_create ( content_type = image_content_type , codename = 'change_image' , defaults = { #NEWLINE# #INDENT# 'name' : 'Can change image' , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( delete_image_permission , _created ) = Permission . objects . get_or_create ( content_type = image_content_type , codename = 'delete_image' , defaults = { #NEWLINE# #INDENT# 'name' : 'Can delete image' , #NEWLINE# #UNINDENT# } ) #NEWLINE# for group in Group . objects . filter ( name__in = [ 'Editors' , 'Moderators' ] ) : #NEWLINE# #INDENT# group . permissions . add ( add_image_permission , change_image_permission , delete_image_permission )