From 762bd34c3699875d315d478b3efb090155beb743 Mon Sep 17 00:00:00 2001
From: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Date: Sun, 7 Jan 2018 05:24:44 +0500
Subject: [PATCH] Fixed #28842 -- Added SpatiaLite support for ForcePolygonCW
 function.

---
 django/contrib/gis/db/backends/spatialite/operations.py | 3 ++-
 docs/ref/contrib/gis/functions.txt                      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index ad64c76887..6aa2c279dd 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -67,6 +67,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
         return 'CAST (AsEWKB(%s) AS BLOB)' if self.spatial_version >= (4, 3, 0) else 'AsText(%s)'
 
     function_names = {
+        'ForcePolygonCW': 'ST_ForceLHR',
         'Length': 'ST_Length',
         'LineLocatePoint': 'ST_Line_Locate_Point',
         'NumPoints': 'ST_NPoints',
@@ -78,7 +79,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
 
     @cached_property
     def unsupported_functions(self):
-        unsupported = {'BoundingCircle', 'ForcePolygonCW', 'ForceRHR', 'MemSize'}
+        unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'}
         if not self.lwgeom_version():
             unsupported |= {'Azimuth', 'GeoHash', 'IsValid', 'MakeValid'}
         return unsupported
diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt
index 84f699f9cb..fd5b83a475 100644
--- a/docs/ref/contrib/gis/functions.txt
+++ b/docs/ref/contrib/gis/functions.txt
@@ -285,7 +285,8 @@ representing the bounding box of the geometry.
 
 .. versionadded:: 2.1
 
-*Availability*: `PostGIS <https://postgis.net/docs/ST_ForcePolygonCW.html>`__
+*Availability*: `PostGIS <https://postgis.net/docs/ST_ForcePolygonCW.html>`__,
+SpatiaLite
 
 Accepts a single geographic field or expression and returns a modified version
 of the polygon/multipolygon in which all exterior rings are oriented clockwise