I'd like to pass form data from one view to another.  

Here's my attempt: 

*#Models.py*from django import forms
class Textizer(forms.Form):
    to_textize = forms.CharField(max_length=100)
    
    def __unicode__(self):
        return self.to_textize
*#views.py*from textize.models import Textizerfrom django.http import 
HttpResponseRedirectfrom django.shortcuts import render_to_responsefrom 
django.core.context_processors import csrf
def index(request):
    if request.method == 'POST':
        form = Textizer(request.POST)
        
        if form.is_valid():
            request.session['text'] = form.cleaned_data['to_textize']
            return HttpResponseRedirect('/results')
        
    else:
        form = Textizer()
        
    c = {'form': form}
    c.update(csrf(request))
    return render_to_response('C:/Documents and 
Settings/quansai/projects/textsite/templates/index.html', c)
    def results(request):
    text = request.session.get('text', None)
    c = {'text' : text}
    return render_to_response('C:/Documents and 
Settings/quansai/projects/textsite/templates/results.html', c)


I really don't understand the following, and I've read the documentation over 
and over.  I've been on this for two days:


   - How to initiate a session
   - How sessions are checked
   - How to retrieve form data from one page to handle the data on another.

Again, I've read through the documentation.  I've asked on IRC but everyone 
pretty much just says "RTFM" even when I tell them I have.  This is absolutely 
frustrating as an extreme beginner.

I'd also like to add that I DO understand the core Python language.  Please, 
unless it's absolutely necessary, don't try explaining to me what a dictionary, 
tuple, list, etc... is.  I've already had my intelligence insulted by the users 
on IRC in this regard.  I really just don't understand the sessions 
documentation. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/1xFNBaS1eogJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to