On 1/5/07, Ramdas S <[EMAIL PROTECTED]> wrote:
have considered all your suggestions and have tried something like this. But
it still fails. I have numerous errors, I guess. I have marked in yellow,
potential issues.
Many Thanks if you can help me fix it
The logic in your view is a little off. If there is no POST data, you
want to initialize the form with no data so try this:
def register(request):
if request.user.is_authenticated():
# Do Not register users already there
return render_to_response('quizapp/register.html',
{'has_account': True})
if request.method = 'POST':
form = RegistrationForm(request.POST)
if form.is_valid():
# your code here...
# ...
return
render_to_response('quizapp/register.html', {'created': True})
else:
form = RegistrationForm()
return render_to_response('quizapp/register.html', {'form': form })
Note that the last line is not inside the else and gets called either
if there was no POST data (as an empty form) or if the POST data is
NOT valid (so the form is redisplayed with error messages and
pre-populated with the errant data)
--
----
Waylan Limberg
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---