On Thursday, March 21, 2013 9:47:03 PM UTC-4, Aubrey Stark-Toller wrote:
>
> On Thu, Mar 21, 2013 at 03:40:39PM -0700, Rainy wrote: 
> > I believe you can just set self.my_flag = foo in clean method and then 
> > check for 
>
>
> Cheers for the reply. 
>
> I suspect my original mail could have clearer. Just setting attributes 
> when 
> checks fail seems to me to be the best way to do this, but it does mean 
> that 
> if I need to check if, say, an integer field is invalid as it contains a 
> string then I'd to reimplement this validation in the clean method so that 
> it 
> sets the necessary attribute on the form, and so on for any other field 
> clean 
> methods that I may need to use and check. 
>
> I realise this is a little beyond what Django's forms where meant for and 
> I 
> might have to live without some of Django's built-in validation to get 
> this 
> to work, but I'd thought I'd see if anyone here had any thoughts. 
>
> Aubrey 
>


Hi Aubrey,

I'm not sure why you think you'll need to override individual clean methods 
for
fields. You write:

  I have form class that has a relatively lengthy clean method which does 
field 
  validation (as the validity of fields depends on the values of fields) as 
well  
  setting error messages on the form itself.
 
So my suggestion is to check, in that single clean method, which fields have
errors and to set your flags accordingly. 

HTH! -ak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to