You're passing two different dictionary parameters there. Try something
like this:
ctx = { 'customers':customers, 'form': form }
return render_to_response('index.html', ctx)
On Wednesday, May 14, 2014 3:22:22 PM UTC-7, G Z wrote:
>
> def index(request):
> form = SignUpForm(request.POST or None)
> if form.is_valid():
> save_it = form.save(commit=False)
> save_it.save()
> customers = Customer.objects.all()
> ctx = { 'customers':customers }
> return render_to_response('index.html', ctx, { 'form': form })
> <-- this is how the documentation says to do it is there another way
> because this gives me an error
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8000/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
> 114. response = wrapped_callback(request,
> *callback_args, **callback_kwargs)
> File "/root/djangoprojects/provisioning/vmware/views.py" in index
> 16. return render_to_response('index.html', ctx, { 'form': form })
> File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/__init__.py"
> in render_to_response
> 29. return HttpResponse(loader.render_to_string(*args, **kwargs),
> **httpresponse_kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in
> render_to_string
> 171. context_instance.pop()
>
> Exception Type: TypeError at /
> Exception Value: pop expected at least 1 arguments, got 0
>
>
>
> On Wednesday, May 14, 2014 4:08:38 PM UTC-6, G Z wrote:
>>
>> how do i do that?
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c50946ab-3613-4263-8b6e-05d19a91eab4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.