Hey all,

I am very new to Django and am having a bit of trouble with something
and I'm hoping I can get some help from you all.

I was just wondering how do I share say a list or dictionary between
views?

What I have at the moment is.............

from django.shortcuts import render_to_response
from django.http import HttpResponse

myList = ["http://localhost:1";, "http://localhost:2";]

def index(request):
        head = "<html><head><title>Viewer</title></head>"

        thelist = ""

        for i in myList:
                thelist = ('%s <li> <a href=%s>Test<a> </li>') % (thelist, i)

        body ="<body><ul>%s</ul></body>" % thelist
        tail = "</html>"
        print thelist
        html = head,body,tail

        return HttpResponse(html)

def update(request):

        query = request.GET.get('t', '')
        print query
        myList.append(query)
        html ="<html><head><title>Upload</title></head><body>Upload OK %s</
body</html" % query

        return HttpResponse(html)


In my update the "query" variable is added to the list myList, but a u
is appended which seams to be the url of the app, is there a way to
remove this u, or is there a better way to share data like a dict or
list between views?

Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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