parameters: (self, request, pk)
return_statement: return redirect(reverse('gallery:index'))
docstring: Save changes in image.
docstring_summary: Save changes in image.
docstring_tokens: Save changes in image .
function: def post(self, request, pk):
          """
          Save changes in image.
          """
          x = request.POST.get('x')
          y = request.POST.get('y')
          x2 = request.POST.get('x2')
          y2 = request.POST.get('y2')
          item = get_object_or_404(UserGalleryItem, pk=pk)
          filename = item.picture_name
          filepath = item.get_filepath()
          file = os.path.join(filepath, filename)
          box = (int(x), int(y), int(x2), int(y2))
  
          img = Image.open(file)
          img.crop(box).save(file)
          create_gallery_thumbnail(request.user.username, filename)
  
          return redirect(reverse('gallery:index'))
function_tokens: def post ( self , request , pk ) : x = request . POST . get ( 'x' ) y = request . POST . get ( 'y' ) x2 = request . POST . get ( 'x2' ) y2 = request . POST . get ( 'y2' ) item = get_object_or_404 ( UserGalleryItem , pk = pk ) filename = item . picture_name filepath = item . get_filepath ( ) file = os . path . join ( filepath , filename ) box = ( int ( x ) , int ( y ) , int ( x2 ) , int ( y2 ) ) img = Image . open ( file ) img . crop ( box ) . save ( file ) create_gallery_thumbnail ( request . user . username , filename ) return redirect ( reverse ( 'gallery:index' ) )