Create postgresql view in django

822 Views Asked by At

I want to use postgresql view to store intermediate result of queryset in django.

Is there a good way to create a view in django?

Below is the code of the flow I want!

elements = Element.objects.filter(is_active=True, eventcardad__isnull=False)

# save elements to database view

# reuse the query results by using view
1

There are 1 best solutions below

2
On

You can use raw SQL query to do that read this page first.