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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:00:32+00:00 2026-05-25T00:00:32+00:00

I have a django template that looks like this: <head> <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js type=text/javascript></script> <script

  • 0

I have a django template that looks like this:

<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}js/jquery.flot.js"></script>
<!--<script src="c:/src/project/scraper/collegedata/templates/chart.js" type="text/javascript"></script>-->
<script src="{{ STATIC_URL }}js/chart.js" type="text/javascript"></script>

</head>

<body>

    <div id="chart1" style="width:600px;height:300px"></div>


    <script>
       show_graph("{{ chart_type }}", {{ series_names }}, {{ data }}, {{ answer }});
    </script>

    <form action="start">
        <input type="submit" value="Back to Questions" />
    </form>

</body>

</html>

where show_graph is a function in chart.js. However, pycharm gives me one of two errors, either:
unresolved function or method show_graph(), or
invalid number of parameters passed: expected 4

and the function is clearly not being called.

I’m a little confused as to whether or not I can even pass template vars to a js function at all…

Does anyone have any insight?

EDIT:

this generates

<html xmlns="http://www.w3.org/1999/xhtml"><head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"   type="text/javascript"></script>
<script src="/static/js/jquery.flot.js"></script>
<!--<script src="c:/src/project/scraper/collegedata/templates/chart.js" type="text/javascript"></script>-->
<script src="/static/js/chart.js" type="text/javascript"></script>

</head>

<body>

    <div id="chart1" style="width: 600px; height: 300px;"></div>


    <script>
       show_graph("pie", [&lt;ResponseOption: puddentane&gt;, &lt;ResponseOption: down the lane&gt;], [1, 0], 0);
    </script>

    <form action="start">
        <input value="Back to Questions" type="submit">
    </form>

</body></html>

where chart.js looks like (values temporarily hardcoded for troubleshooting, and it should be mentioned that $.plot also gives an unresolved function error):

function show_graph(charttype, series_names, data, answer_index){

    var data = [2000, 50, 400, 200, 5000];

    var data3 = [
    { label: "my cat",  data: 10, color: 'rgb(85, 96, 42)'},
    { label: "my friends",  data: 20, color: 'rgb(105, 118, 52)'},
    { label: "my boyfriend",  data: 30, color: 'rgb(125, 141, 62)'},
    { label: "my job",  data: 30, color: '#42215F'},
    { label: "food",  data: 10, color: 'rgb(145, 164, 72)'},
    { label: "social skills",  data: 0, color: 'rgb(166, 189, 82)'}
];

    alert("in chart.js");

    var charttype = "pie";

    var type = {};
    type[charttype] = {show: true};

    var chart_options = {};
    chart_options["series"]=type;

    var plot = $.plot($("#chart1"), data3, chart_options);
}
  • 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-05-25T00:00:33+00:00Added an answer on May 25, 2026 at 12:00 am

    It looks like series_names is just being output as the HTML entities of an object without a proper __unicode__ method. You’re getting:

    show_graph("pie", [&lt;ResponseOption: puddentane&gt;,
    

    Which, decoded, is:

    show_graph("pie", [<ResponseOption: puddentane>, ...
    

    What actually needs passing to the method? You probably need to think about how you want {{ series_names }} to be output, rather than just calling the string representation of that variable. What you’re generating at the moment is invalid Javascript – the console of your browser will probably reinforce this point.

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

Sidebar

Related Questions

I have a form in my forms.py that looks like this: from django import
I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In
I have some template code that looks like: <input type='submit' value='{{ need.satisfied|yesno:Resend this document
To use flickr as an example, a request URL looks something like this: 'http://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key='
I have a string that looks like string ''' <html> <head> {% block head
I have a dictionary with embedded objects, which looks something like this: notes =
I have an app that serves pages like this /stage/ stagename . stagename is
I'm using Google App Engine and Django templates. I have a table that I
Does Django have any template tags to generate common HTML markup? For example, I
I am running Django trunk and have template Autoescaping on (default). Do I need

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.