# how to send multiple data to frontend

**URL:** <https://forum.djangoproject.com/t/how-to-send-multiple-data-to-frontend/24004>\
**Category:** Templates & Frontend\
**Created:** [September 20, 2023, 1:48pm UTC](https://forum.djangoproject.com/t/how-to-send-multiple-data-to-frontend/24004 "2023-09-20T13:48:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bosancero](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@bosancero](https://forum.djangoproject.com/u/bosancero)\
**Post date:** [September 20, 2023, 1:48pm UTC](https://forum.djangoproject.com/t/how-to-send-multiple-data-to-frontend/24004/1 "2023-09-20T13:48:54Z")

</div>

Hello,

I’m newbee to Django and sitting in stuck. I need to send multiple model filter to frontend and how to do that ?

Class based view  
code:

```auto
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy

from .models import Post

# Create your views here.
class BlogListView(ListView):
    queryset = Post.objects.filter(status=1).order_by("-created_on")
    template_name = "home.html"

```

I need also to send Post.objects.filter(is\_top=True) and how is it possible to send multiple data to frontend ?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 20, 2023, 2:25pm UTC](https://forum.djangoproject.com/t/how-to-send-multiple-data-to-frontend/24004/2 "2023-09-20T14:25:37Z")

</div>

> [@bosancero](#):
>
> I need to send multiple model filter to frontend and how to do that ?

You need to be more specific than this for us to be able to help you.

What do you mean by “multiple model filter”?

What “frontend” are you using?

> [@bosancero](#):
>
> how is it possible to send multiple data to frontend ?

Have you worked your way through the [Official Django Tutorial](https://docs.djangoproject.com/en/4.0/intro/tutorial01/)? If so, then review the work you’ve done on the `ListView` in the polls app.

---

<div class="post-metadata">

**Author:** ![bosancero](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@bosancero](https://forum.djangoproject.com/u/bosancero)\
**Post date:** [September 20, 2023, 5:07pm UTC](https://forum.djangoproject.com/t/how-to-send-multiple-data-to-frontend/24004/3 "2023-09-20T17:07:12Z")

</div>

Hi Kenn,

I found out by my self. It works but I think it’s correct way to do that. What I means is this hope you can figure out what I mean by looking my code.

I’m using class based view. I think it’s called like that.

```auto
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy

from .models import Post

# Create your views here.
class BlogListView(ListView):
    queryset = Post.objects.filter(status=1).order_by("-created_on")
    template_name = "home.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        # context["post_list"] = Post.objects.filter(status=1).order_by("-created_on")
        context["top"] = Post.objects.filter(is_top=True).first()
        context["featured_posts"] = Post.objects.filter(is_featured=True).all()
        return context

```
