Django

Code

Ticket #6289 (closed: fixed)

Opened 6 months ago

Last modified 6 months ago

Allow passing extra context to google-map.js

Reported by: omat at gezgin.com Assigned to: jbronn
Milestone: Component: GIS
Version: gis Keywords: gis, google maps, javascript
Cc: jbronn@gmail.com, omat@gezgin.com Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The javascript template for displaying a Google Map is rendered inside the GoogleMap? object with predefined parameters. Sometimes it may be useful to pass extra variables to the javascript temlaplates context.

For that, I patched the gmap.py by adding 2 lines to allow passing an extra_context dictionary.

Attachments

gmap.py (3.8 kB) - added by omat at gezgin.com on 12/30/07 07:22:27.
modified version of gmap.py to allow passing extra context to the js template
6289.diff (1.0 kB) - added by arien on 12/31/07 03:39:12.
patch proposed by reporter

Change History

12/30/07 07:22:27 changed by omat at gezgin.com

  • attachment gmap.py added.

modified version of gmap.py to allow passing extra context to the js template

12/30/07 09:09:49 changed by omat@gezgin.com

  • needs_better_patch changed.
  • version changed from SVN to gis.
  • needs_tests changed.
  • needs_docs changed.

12/31/07 03:39:12 changed by arien

  • attachment 6289.diff added.

patch proposed by reporter

01/13/08 06:27:31 changed by Simon Greenhill <dev@simon.net.nz>

  • stage changed from Unreviewed to Ready for checkin.

01/16/08 22:59:43 changed by jbronn

  • cc set to jbronn@gmail.com.
  • owner changed from nobody to jbronn.
  • status changed from new to assigned.
  • stage changed from Ready for checkin to Unreviewed.

Sounds like a good idea, and I'm all for it -- but I just found out about the ticket so I need to review it first before I'll check it in. Thanks for contributing.

01/16/08 23:30:35 changed by jbronn

  • cc changed from jbronn@gmail.com to jbronn@gmail.com, omat@gezgin.com.
  • stage changed from Unreviewed to Design decision needed.

If we are to go the keyword argument route I'd prefer to call it extra instead of extra_content (similar to IDL syntax). Or we could take it one step further -- add **kwargs, and have whatever additional keywords be sent to the template. A concern would be wanting to add a keyword argument in the future and messing up someone's template.

So I'm open to suggestions -- your thoughts?

01/18/08 10:43:35 changed by jbronn

  • stage changed from Design decision needed to Ready for checkin.

On second thought extra_context is consistent with the Django API (specifically for generic views). No design design required.

01/18/08 10:49:52 changed by jbronn

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7027]) gis: Fixed #6289 (added extra_context keyword to GoogleMap). Thanks omat & arien.


Add/Change #6289 (Allow passing extra context to google-map.js)




Change Properties
Action