Opened 3 years ago

Closed 5 months ago

Last modified 5 months ago

#20415 closed Bug (fixed)

broken SRID in gis.admin javascript when "USE_THOUSAND_SEPARATOR = True"

Reported by: pierremarc07@… Owned by: timgraham
Component: GIS Version: 1.8
Severity: Normal Keywords: gis, admin, srid
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

broken SRID in gis.admin javascript when "USE_THOUSAND_SEPARATOR = True"

geodjango_mpoly.get_ewkt = function(feat){return 'SRID=900 913;' + geodjango_mpoly.wkt_f.write(feat);}

the following change in contrib/gis/templates/gis/admin/openlayers.js fixed the problem

- {{ module }}.get_ewkt = function(feat){return 'SRID={{ srid }};' + {{ module }}.wkt_f.write(feat);}
+ {{ module }}.get_ewkt = function(feat){return 'SRID={% localize off %}{{ srid }}{% endlocalize %};' + {{ module }}.wkt_f.write(feat);}


Change History (10)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Even simpler: {{ srid|unlocalize }}

comment:2 Changed 3 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 0a29057ebea4335d503e373e4526b1c62c15bcdc:

Fixed #20415 -- Ensured srid is not localized in openlayers template

Thanks pierremarc07 at gmail.com for the report.

comment:3 Changed 5 months ago by olivierdalang

  • Resolution fixed deleted
  • Status changed from closed to new
  • Version changed from 1.5 to 1.8

Hi,

I get this bug again (tested in 1.8.5 and 1.8.8).

As soon as I add USE_THOUSAND_SEPARATOR = True in settings.py, the default map widgets in the admin stop working, as I get this javascript error :

`Uncaught SyntaxError: Unexpected token ,` `(index):151`

The javascript indeed looks like :

var options = {
            ...
            map_srid: 4,326,
            ...
        };

comment:4 Changed 5 months ago by timgraham

  • Has patch unset
  • Owner changed from nobody to timgraham
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

comment:5 Changed 5 months ago by timgraham

  • Has patch set

Could you check that this patch fixes the issue?

comment:6 Changed 5 months ago by olivierdalang

Hi, yes this seems to fix it ! Many thanks !

Question : will the fix be backported to 1.8 ?

comment:7 Changed 5 months ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 5 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 19d1cb14:

Fixed #20415 -- Ensured srid isn't localized in OpenLayers JavaScript.

comment:9 Changed 5 months ago by Tim Graham <timograham@…>

In efd8554:

[1.9.x] Fixed #20415 -- Ensured srid isn't localized in OpenLayers JavaScript.

Backport of 19d1cb14519186902d7e27813bf2643fe3f7cfa3 from master

comment:10 Changed 5 months ago by Tim Graham <timograham@…>

In 2296662:

[1.8.x] Fixed #20415 -- Ensured srid isn't localized in OpenLayers JavaScript.

Backport of 19d1cb14519186902d7e27813bf2643fe3f7cfa3 from master

Note: See TracTickets for help on using tickets.
Back to Top