views:

512

answers:

3

Hi, I have got problem with django's UserCreationForm. It's very strange because ween I:

view:

from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import render_to_response

form = UserCreationForm()

context = {'form' : form}

render_to_response('something.html', context)

template:

...
{% block content %}
{{form}}
{% endblock %}

I get:

<class 'django.contrib.auth.forms.UserCreationForm'> 

Stuff like {{form.as_table}} or similar doesn't work. "For" tags scream that:

aught an exception while rendering: 'ModelFormMetaclass' object is not iterable

I don't know where is the problem. I simply can't view in template labels and fields. HELP:p

A: 

You should have missed something in the code.

What must had lead you to this error is:

form = UserCreationForm

{% for field in form1 %}{{ field }}{% endfor %}

Here the error is that you missed the parentheses after UserCreationForm

Antony Hatchkins
+1  A: 

Could you post the code of the view you're actually trying? It seems as if you've written:

form = UserCreationForm

rather than

form = UserCreationForm()
Michael Williamson
A: 

Yep, that is the point! Thank YOU all for help. I had tried everything. Now it works:)

nykon
You're welcome. I'm glad you did it :) You could vote for an answer as well ;) thanks
Antony Hatchkins