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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:58:20+00:00 2026-05-27T00:58:20+00:00

In django, I can render a html template from a view action like this:

  • 0

In django, I can render a html template from a view action like this:

return render_to_response('video_handle/view.html', {'filename': filename, \
'frame_count': frame_count, 'folder': folder})

This would render the “view.html” template and would give me access to the variables filename, frame_count and folder inside the template, so doing this works perfectly:

<script type="text/javascript">
file_name = '{{filename}}'
frame_count = '{{frame_count}}'
folder = '{{folder}}'
</script>

Now, when i try the same in a coffescrip file, compile the file to javascript and load it to my view.html template, the values of python’s variables are not assigned to javascript variables and instead, these variables keep the string value meaning that form example file_name variable keeps the value of this string ‘{{filename}}’ instead of the actual value of the python’s variable called filename.

Any idea on what’s happening and how to solve it?

  • 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-27T00:58:21+00:00Added an answer on May 27, 2026 at 12:58 am

    If I understand your question right, then what is happening is that CoffeeScript files aren’t being processed (only your template is being processed and therefore being passed the variables).

    If you absolutely need to pass data from backend to frontend in such a fashion you can just use what you have, JavaScript variables will be accessible to you, so if you load your JavaScript below this <script> tag, you will have access to file_name, frame_count etc.

    I’d suggest putting this data in an object, in order to not pollute global namespace with these variables:

    <script>
    var options = {
      fileName : '{{file_name}}',
      frameCount : '{{frame_count}}'
      // more options here
    };
    </script>
    

    And then you can use them with dot notation (also in CoffeeScript):

    alert options.fileName # should alert the file name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my view: def rsvp_list(request, id, template=rsvp/rsvp_list.html): rsvp = RSVP.objects.get(id=id) return render_to_response(template, { 'attendees':
This is my code: from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from
When I render a page using the Django template renderer, I can pass in
I am trying to pass in url parameters to a django template like this...
I am trying to sum in HTML,but template tag return 0 , View.py def
As we all know (or should), you can use Django's template system to render
The django csrf middleware can't be disabled. I've commented it out from my Middleware
I am sending an AJAX request to a Django view that can potentially take
How can i clean and modify data from a form in django. I would
How can you get the SQL for a Django model's .save(), i.e. from django.db

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.