HOW TO OUTPUT DATA GOT FROM combined queryset IN DJANGO TEMPLATE html file

0 votes
Hey!  Am having a problem. And l request for your Help.

Am having 3 apps in Django project
- action
- adventure
- others


#action/ models.py

....
class Action(models.Model):
    name=models.Charfield()
    os= models.Charfield( choices=OS)....



#adventure/models.py


....
class Adventure(models.Model):
     name=models.Charfield()
     os= models.Charfield( choices=OS)....



#Others/views.py


from itertools import chain
from action.models import Action
from adventure.models import Adventure

def windows_games(request):
    win_action = Action.objects.filter(os='windows')
    win_adventure = Adventure.objects.filter(os='windows')
    combined_list = list(chain(win_action,win_adventure))
    context = ['combined_list':combined_list,]
         return render(request, 'others/os/windows_game.html' , context)



#others/os/windows_game.html

.....
<div class="container">
 <img src="{{combined_list.game_pic}}">
 <p>{{combined_list.name}}</p>
.....








1). I need to correct me in #others/ views.py  if there is any mistake done.

2). I would like to know how to know how to write the tag that outputs the results in #others/os/windows_game.html because I tried that but outputs nothing.
And l would like to be in form of,              #{{combined_list.game_pic}}, etc
Jan 13, 2023 in Python by anonymous

edited Mar 4, 2025 282 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP