Re: Seeing form validation errors

2009-06-11 Thread zayatzz
Well i found a solution finally... http://kfarr.com/2008/04/04/making-a-complex-customized-django-form-template-remember-to-include-errorsnon_field_errors/ If anyone else has this kind of problem then you could go ahead and check this example too : http://opensource.washingtontimes.com/blo

Re: Seeing form validation errors

2009-06-10 Thread zayatzz
Nice... it worked... If i use form.as_p it gives me output of all form errors before the form, just as i want, but form as paragraph does not look very nice and i rather use my own template for it which looks like this: {% for field in form %}

Re: Seeing form validation errors

2009-06-09 Thread zayatzz
Aha! I will try that when i get back home. Thanks! Alan On Jun 9, 2:50 pm, Karen Tracey wrote: > On Tue, Jun 9, 2009 at 2:19 AM, zayatzz wrote: > > > Well thats what i was complaining about in the beginning that i could > > use good example of how to do it. Its quite confusing how form > > v

Re: Seeing form validation errors

2009-06-09 Thread Karen Tracey
On Tue, Jun 9, 2009 at 2:19 AM, zayatzz wrote: > > Well thats what i was complaining about in the beginning that i could > use good example of how to do it. Its quite confusing how form > validation is on one page, errors on the others and views on third and > there is not single full example. >

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
Well thats what i was complaining about in the beginning that i could use good example of how to do it. Its quite confusing how form validation is on one page, errors on the others and views on third and there is not single full example. How should the else part be? else: message = "form was

Re: Seeing form validation errors

2009-06-08 Thread Karen Tracey
On Mon, Jun 8, 2009 at 3:57 PM, zayatzz wrote: > > Well now this is working just fine: > > [snip AccountForm] > > But this (code below) still does not return me any error messages from > form validation. > >form = AccountForm(request.POST) >user = request.user >

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
Well now this is working just fine: class AccountForm(forms.Form): username = forms.CharField(max_length=100, help_text="Enter Username of your account", label="Your username") email = forms.EmailField(max_length=100, help_text="Enter your e-mail address", label="Your e-mail addre

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
I think i already tried that, Michael, and i got some error that had something to do with nonetype... since there is no pwd in data, you cant compare if its equal or not to '' Alan. On 8 juuni, 17:24, Michael wrote: > On Mon, Jun 8, 2009 at 10:09 AM, zayatzz wrote: > > > So i change pwd and pw

Re: Seeing form validation errors

2009-06-08 Thread Michael
On Mon, Jun 8, 2009 at 10:09 AM, zayatzz wrote: > > So i change pwd and pwdc to required=False and in clean i do > if pwd in data (or if ["pwd"] not in data): >if data.get("pwd") != data.get("pwdc"): >raise forms.ValidationError("Passwords do not match") > return data > > and i get

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
So i change pwd and pwdc to required=False and in clean i do if pwd in data (or if ["pwd"] not in data): if data.get("pwd") != data.get("pwdc"): raise forms.ValidationError("Passwords do not match") return data and i get errorfree clean function? Alan On Jun 8, 4:29 pm, Michael w

Re: Seeing form validation errors

2009-06-08 Thread Michael
On Mon, Jun 8, 2009 at 2:05 AM, zayatzz wrote: > > Great :). Thanks... > > Wish i had read your post more thoroughly the first time. > > This takes care of my second problem, but what about the first one - > why do password fields need to be filled? Because empty(or nonexisting > data) fields can

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Great :). Thanks... Wish i had read your post more thoroughly the first time. This takes care of my second problem, but what about the first one - why do password fields need to be filled? Because empty(or nonexisting data) fields cannot be compared in 2nd if ? Then what is the syntax for makin

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 2:54 PM, zayatzz wrote: > > Line 43 - if form.is_valid(): > Line 44 - message = "form valid: " + form.cleaned_data['username'] > > Alan > On Jun 7, 9:45 pm, Alex Gaynor wrote: > > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz > wrote: > > > > > When the form does pass all t

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Line 43 - if form.is_valid(): Line 44 - message = "form valid: " + form.cleaned_data['username'] Alan On Jun 7, 9:45 pm, Alex Gaynor wrote: > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > > When the form does pass all that validation i get this error in view : > > > Exception Type:    

Re: Seeing form validation errors

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > When the form does pass all that validation i get this error in view : > > Exception Type: TypeError > Exception Value: > 'NoneType' object is unsubscriptable > Exception Location: /home/projects/tst/profile/views.py in > profile_deta

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
When the form does pass all that validation i get this error in view : Exception Type: TypeError Exception Value: 'NoneType' object is unsubscriptable Exception Location: /home/projects/tst/profile/views.py in profile_detail, line 44 Line 44 is - message = "form valid: " + form.clean

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Thanks to both of you! I changed template form tag to {{ form.as_p }} I figured that since my posting view did not give form to context again, but did just redirect, that i had to change this. I also added custom messages to pass to the template from different parts of the view - if request is

Re: Seeing form validation errors

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > [snip form def] > For some reason the view does not save the stuff i get with form and i > want to figure out why. > > Perhaps form does not validate for some reason... Where or how can i > see those validationerrors.. how

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > class AccountForm(forms.Form): >username = forms.CharField(max_length=100, help_text="Enter Username > of your account", label="Your username") >email = forms.EmailField(max_length=100, help_text="Enter your

Seeing form validation errors

2009-06-07 Thread zayatzz
I have this form: class AccountForm(forms.Form): username = forms.CharField(max_length=100, help_text="Enter Username of your account", label="Your username") email = forms.EmailField(max_length=100, help_text="Enter your e-mail address", label="Your e-mail address") first