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
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 %}
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
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.
>
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
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
>
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
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
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
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
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
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
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
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:
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
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
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
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
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
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
20 matches
Mail list logo