Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8202453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:11:24+00:00 2026-06-07T07:11:24+00:00

I have a following extra_context in my views.py. extra_context = { ‘user’: list_user, ‘time’:

  • 0

I have a following extra_context in my views.py.

extra_context = {
    'user': list_user,
    'time': str(list_time),
    'latlng': list_latlng
}

All of the above variables are datatype of python list. Now i want to use these variable in Gmap v3 javascript. I found a following snippet for google map: (posting the main part)

<script type="text/javascript">
var map ;
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
  zoom: 2,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.TERRAIN 
};

map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

var flightPlanCoordinates = [ {% for ip in latlng %}{{ ip }}{% endfor %}];
for(var i in flightPlanCoordinates){
    var marker = add_marker(flightPlanCoordinates[i][0], flightPlanCoordinates[i][1],"Some title!","html for info box");
    marker.setMap(map);
    }
}

function add_marker(lat,lng,title,box_html) {
var infowindow = new google.maps.InfoWindow({
    content: box_html
});

var marker = new google.maps.Marker({
      position: new google.maps.LatLng(lat,lng),
      map: map,
      title: title
});

google.maps.event.addListener(marker, 'click', function() {
  infowindow.open(map,marker);
});   

return marker;

}

The above code shows a marker accoriding to the latlng list passed from the context. But the problem is occurring at that time when i also tried to pass time and user with the same way. It shows nothing on the Map. By the way i tried with this coide:

var user = [{% for i in user %}{{ i }}{% endfor %}]; 
var timestamp = [{% for y in time %}{{ y }}{% endfor %}];

Is that the right way? I am new in javascript i wrote according the latlng code.

I tried with alert(timestamp). Nothing happens 🙁

Another problem is i have to pass these three parameter to add_marker
java script method. TO do this i have to run three for loop concurrently. Posting the pseudo code:

var user = [{% for i in user %}{{ i }}{% endfor %}]; 
var timestamp = [{% for y in time %}{{ y }}{% endfor %}];
var flightPlanCoordinates = [ {% for ip in latlng %}{{ ip }}{% endfor %}];
for (var in flightPlanCoordinates) and for (a in timestamp) and for(b in user)
{
  var marker = add_marker(flightPlanCoordinates[i][0], flightPlanCoordinates[i][1],b,a);
marker.setMap(map);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:11:26+00:00Added an answer on June 7, 2026 at 7:11 am

    You need to define your variables as:

    var user = [{% for i in user %}{{ i }}{% if forloop.last %} {%else%} , {%endif%} {% endfor %}];

    i.e. add comma between the values in array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following script that executes all the .reg files in the current directory.
I have the following code, but it doesn't put the scrolling div anywhere. All
I have an InfoListAdapter that uses the following code to populate views in the
I have the following HTML and you can see the extra space between the
I have the following in ~/.vim/ftplugin/python.vim to highlight long lines, accidental tabs and extra
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>
I have following fiddle: http://jsfiddle.net/BFSH4/ As you see there are two issues: The h1
I have following nested objects. I am using @Valid for validation in my controller.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.