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 8177337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:29:00+00:00 2026-06-06T23:29:00+00:00

First of all, I am a newbie at programming. I am trying to make

  • 0

First of all, I am a newbie at programming. I am trying to make a web page where you have a Google Map embedded, and in this Map you can see a colored line that sets a path.
For this, I am using Django.
In my views.py I have a variable called points, where I have some coordinates written in a list, as a string.
For example,

points = ('-15.4566620,28.07163320','15.7566620,29.07163320',....)

Then, in the google maps script, I have:

var flightPlanCoordinates = [

        new google.maps.LatLng(-15.4566620,28.07163320),
        new google.maps.LatLng(-15.7566620,29.07163320),

                ];

So when I display my page, I see a line between those points.

I would like to have, instead of that, something like:

var flightPlanCoordinates = [

                   {% for point in points %}

                         new google.maps.LatLng({{point}}),

                   {% endfor %}

                ];

But this doesn’t work.

What am I doing wrong, and how should it be?

Thank you very much.

  • 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-06T23:29:01+00:00Added an answer on June 6, 2026 at 11:29 pm

    The objective is to get the template to render the path array the same as if it were hardcoded. You should check the rendered webpage’s source code to be sure.

    It’s best to remove that trailing comma, even if it does work with it. You can use the forloop.last to omit it in the last point.

    I’m following a style as in the polls tutorial. Make sure the view is sending the points variable to the template:

    urls.py

    urlpatterns contains url(r'^map/$', 'polls.views.map'),

    views.py

    def map(request):
        points = ('0,0', '10,0', '10,10', '0,10')
        return render_to_response('polls/map.html', { 'points': points })
    

    template map.html

    ...
    var mypolyline = new google.maps.Polyline({
        map: map,
        path: [
          {% for point in points %}
            new google.maps.LatLng({{ point }}) {% if not forloop.last %},{% endif %}
          {% endfor %}
        ]
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm newbie in C++ programming. I'm trying to see the benefits from moving all
First of all, apologize because I have seen some posts about this, but I
I am a newbie to AS400-Java programming. I am trying to create my first
to all im newbie developer and trying to create my first iPhone app, sorry
First of all, I'm quite a newbie in FluentNHibernate. I have these DB tables,
First of all a statement: I'm a newbie when it comes to programming for
First of all, I'm a Rails newbie. I can hold my own in Ruby,
First of all, a django newbie, so take it easy ;) I'm trying to
First of all, I'm really a newbie in Cystal Reports, so please have patience
First of all: I am completely a newbie in mutex/multithread programming, so sorry for

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.