I have a chat. One view is responsible for displaying the list of chats and chat content:
def chats_view(request, chat_uuid=None):
if chat_uuid:
context = {
# Variables for displaying both the list and chat content
}
return render(request, 'chats/chats.html', context)
else:
context = {
# Variables for displaying only the list of chats
}
return render(request, 'chats/chats.html', context)
On the "/chats/" URL, only the list of chats should be displayed, and on the "/chats/<chat_uuid>/" URL, both the list of chats and the content of the selected chat should be displayed. When clicking on any chat without reloading the page, a window with the chat content should appear next to it, and the URL should change from "/chats/" to "/chats/<chat_uuid of the selected chat>".
I tried to do this using AJAX, but in the HTML content there are Django template tags and they are rendered as text.