I would like to know if it possible to send a model or a list using django.
I know that doing this is certainly not the best way. But I need to now.
I'm trying to do this
def article(request):
articles = Article.objects.all()
response = render(request, 'someHtml.html',{'articles': articles})
if request.POST:
response.set_cookie('articles', articles)
return response
but doing this way the model article turns string and I would like a django model, like a bellow.
def another_fuction_view(request):
if 'articles' in request.COOKIES['articles']:
articles = request.COOKIES['articles']
else:
articles = ['not exists']
return render(request, 'anotherview.html', {'articles': articles})
I hope my arm does not fall because of it heuheuhe