raise error for form attribute

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

raise error for form attribute

Naveen Yadav
Hi,

I am working on my first issue. Part of solution seems like
1. checking the concerned fields
2. raising the error if required


After going through the source code, I realized there two ways to resolve the issue, first one seems raise error at appropriate place although a few doubts about this

raise error:

  1. appropriate place to raise error clean() of form class, Will it be fine if i raise error here ?
non_field_error

second solution would be add non_field_error for the form.

Any feedback would be helpful

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/74b94cdc-987d-40bf-a956-7a5a97fe7cc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: raise error for form attribute

Adam Johnson-2
clean() and non_field_error both seem like the wrong place since they happen after the first rendering of the form. You should be able to raise it on initialization, no?

On 10 May 2017 at 10:19, Naveen Yadav <[hidden email]> wrote:
Hi,

I am working on my first issue. Part of solution seems like
1. checking the concerned fields
2. raising the error if required


After going through the source code, I realized there two ways to resolve the issue, first one seems raise error at appropriate place although a few doubts about this

raise error:

  1. appropriate place to raise error clean() of form class, Will it be fine if i raise error here ?
non_field_error

second solution would be add non_field_error for the form.

Any feedback would be helpful

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/74b94cdc-987d-40bf-a956-7a5a97fe7cc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM3n3160k_8hthMVWUtPku%3DqmbBQ6jaagfo4sA45EFzaRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: raise error for form attribute

Naveen Yadav
In reply to this post by Naveen Yadav


On Wednesday, 10 May 2017 16:48:00 UTC+5:30, Naveen Yadav wrote:
Hi,

I am working on my first <a href="https://code.djangoproject.com/ticket/28171" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28171\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH417Lib2aIrTfszFOd1PWqL8ptbg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28171\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH417Lib2aIrTfszFOd1PWqL8ptbg&#39;;return true;">issue. Part of solution seems like
1. checking the concerned fields
2. raising the error if required


After going through the source code, I realized there two ways to resolve the issue, first one seems raise error at appropriate place although a few doubts about this

raise error:

  1. appropriate place to raise error clean() of form class, Will it be fine if i raise error here ?
non_field_error

second solution would be add non_field_error for the form.

Any feedback would be helpful

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5516d7d4-079a-4253-8477-9220516ea877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.