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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:24:11+00:00 2026-05-19T01:24:11+00:00

I am making a website that displays a user’s chosen youtube videos. A user

  • 0

I am making a website that displays a user’s chosen youtube videos. A user can enter a comment for each video.

I want to display (in this order):

  1. User comment

  2. video title

I have already made the view and have created the following list of dictionary items. Each one represents one video. I send this to my html page:

[
    {"my_own_object": vid_obj1, "youtube_obj": obj1} 
    {"my_own_object": vid_obj2, "youtube_obj": obj2}
]

“youtube_obj” is the object supplied by youtube, which contains the url, title, rating, etc. “my_own_object” contains the user’s comments as well as other information.

I iterate over the list and get one dictionary/video. That’s fine. Then I need to display the video’s information:

{% for key,value in list.items %}

   {% if key = "my_own_object" %}
       <div>
       <p>{{value.user_comment}}</p> 
      </div>  
   {% endif %}  
   {% if key = "youtube_obj" %}
       <div>
       <p> {{value.media.title.text}}</p> 
      </div>  
   {% endif %}                  
{% endfor %}

This works, except that, because I cannot determine the dictionary order, I might end up with:

  1. Video title

  2. User comment

I thought I could get around this by assigning variables (and then printing the values in the proper order), and am still reeling from the fact that I cannot assign variables!

So, how can I get around this? Can I pluck the key/value that I need instead of iterating over the dictionary items – I tried looking for ways to do this, but no luck. Any other ideas? (I need to pass both video objects as I may need more information than comment and title, later.)

  • 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-19T01:24:12+00:00Added an answer on May 19, 2026 at 1:24 am

    You can use dictionary keys directly:

    {% for item in list %} {# PS: don't use list as a variable name #}
        <p>{{item.my_own_object.user_comment}}</p>
        <p>{{item.youtube_obj.media.title.text}}</p>
    {% endfor %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a small section of an app (phone and website) that can
I'm working on making a website/web application that displays images every 5 or so
I'm making a website that displays questions/flashcards. First, I load a set of flashcards
i m making an iphone app that displays data from a website on a
I am making a news website but I want to let the user insert
I'm making website that have notification 'button'. When user click this button, notification div
I am making a website that displays 20 records per page, up to an
So, I understand that each user of my website will have an Auth_key after
I'm making a website that tend to handle all the request in one page
I'm making a website that mail users when a movie or a pc game

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.