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

Am having a problem. And l request for your Help.

Am having 3 apps in Django project

  • action

  • adventure

  • others



class Action(models.Model):


    os= models.Charfield( choices=OS)....



class Adventure(models.Model):


     os= models.Charfield( choices=OS)....


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)



<div class="container">

 <img src="{{combined_list.game_pic}}">


1). I need to correct me in #others/ 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

It needed to display all items created in those models to display in windows_game page, after filtering those that only follow in category of windows.

I tried creating the context but there was no output results.

One of my friend here helped me like that bellow and it worked for me #Windows_game.html

{% for game in combined_list %}
<p> {{game.game_name}}</p>
{% endfor %}
Back to Top