[Answer]-How to send large amount of text between two views using Django

1๐Ÿ‘

โœ…

As per your url definition, the new_view url does not take any parameter hence the error that you are getting.

But passing data in url, specifically large data as you mentioned, is not good. Cookies or django sessions are much better option.

To use django session update your view as

def sender(request):
    if form.is_valid():
        cd = form.cleaned_data
        letter = cd['post']
        request.session['post_data'] = letter
        next = reverse('new_view',)
        return HttpResponseRedirect(next)


def new_view(request,):
    post_data = request.session.get('post_data')
    return render(request, 'new_view.html', {'post': post})
๐Ÿ‘คRohan

Leave a comment