-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Could we have the full traceback? That really isn't enough information to determine your problem.
Regards, Luke [email protected] rekha wrote: > Hi, im getting ValueError when try to redirect to an html page.. also > the validation code in forms.py doesnt work when i test it with wrong > inputs. it accepts the wrong input also.. what would be the bug? > ===views.py code== > def register(request): > if request.method == 'POST': > form = form_register(request.POST) > if form.is_valid(): > reg = loginform( usr_name = > form.cleaned_data['usr_name'], pswd = > form.cleaned_data['pswd']) > reg.save() > return HttpResponseRedirect('/index/') > #return render_to_response('thanks.html') > else: > form = form_register() > variables = RequestContext(request, {'form':form}) > return render_to_response('register.html',variables) > -------------------------------------------- > ===forms.py code=== > class form_register(forms.Form): > usr_name = forms.CharField(label='Enter your user > name:',max_length=50) > pswd = forms.CharField(label='Password:',widget=forms.PasswordInput > (render_value=False)) > def clean_usr_name(self): > usr_name = self.cleaned_data['usr_name'] > if not re.search(r'^\w+$',usr_name): > raise forms.ValidationError('Username can only contain > alphanumeric > characters and the underscore.') > return usr_name > ------------------------------ > ===urls.py code=== > > urlpatterns = patterns('',(r'^$',index),(r'^register/$',register), > (r'^login/$',login),(r'^index/$',index),(r'^logout/$',logout_page), > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkp607UACgkQXQrGVCncjPw8XQCgknqhHrD5b6dQtZu0nvom2/Sy P8UAoKPUkHsSbgtYHGM0gtmw6n4d5Q1B =51xf -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

