On 12/17/2012 03:58 PM, Kevin Cole wrote:
On Mon, Dec 17, 2012 at 1:57 PM, Kevin Cole <[email protected]> wrote:
And here I'll display my ignorance about threading. I've done nothing
specific to ask for threading. I wouldn't know how to thread even if I
had a sewing machine. ;-) I'm using apache prefork with mod-wsgi. In
testing, I go to the URL page first, which I had hoped would set the
global variable like everywhere else that I set values for small
handful of globals, and that going to the autoname URL after that
would see the global I had set.
s/I go to the URL page first/I go to the login page first/
The desing of the view's of django, do not allow you to pass global
variables between the views. If you want to pass, data between views,
you need to use ajax, to send the data in a get or post requests.
def index(request):
print 'helou'
return render_to_response('index.html', {'lala': 'lala'})
#index.html
# <script type='text/javascript'>
# obj = {type:'get', url='/test/view0', data:
{tamangandapio:'yeah'}, type='json',
# response: function (){ console.log(response) }
# }
# $.ajax(obj);
# </script>
def view0(request)
#here you see the data send by the jquery code below
print request.GET
res = {'success':'i got it'}
return HttpResponse(simplejson.dumps(res),
mimetype='application/javascript')
please don't use global variables in views
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.