• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

215
Views
Django, variable {{ }} inside {% %}

I'm using Django-instagram for simply display Instagram content on my webpage:

{% load instagram_client %}
{% instagram_user_recent_media intel %}

This example works perfect, but the problem is Instagram name changes depending on selected page. I pass it via context:

def about(request, foo_id):
    article = get_object_or_404(Bar, id=foo_id)
    return render_to_response('about.html', {'foo' : article})

It works fine if I'm using it without template:

<p>{{ foo.instagram }}</p> --> returns valid name

How can I pass my "foo.instagram" like this:

{% load instagram_client %}
{% instagram_user_recent_media {{ foo.instagram }} %}
about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use set:

{% set new_var = foo.instagram -%}
{% load instagram_client %}
{% instagram_user_recent_media new_var %}
about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error