Skip to content
Advertisement

Is there a way to call two function-based views from views.py from one url? – Django or even by using Class-based view

I have tried two different style of views: Function-based and class-based. I have two functions in my views.py and i don’t know how to call both of them under single same url. I have seen suggestions to combine both functions into one but it still doesn’t work.

Tried get() from class-based view and called the same url with different views

JavaScript

Advertisement

Answer

There is no way in django to put two views against one url. Maybe you can combine those functions in one Class based view and its pretty simple actually. For example:

JavaScript

And in template, you should get the values in {{ chart }} and {{ chart2 }} variables.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement