Am Freitag, 23. November 2007 14:37 schrieb Wolfram Kriesing:
> this has two drawbacks:
> 1) the URL is validated in the "wrong" place (in clean() instead of
> clean_url())
> 2) the error, if one occurs, is not assigned to the errors['url']
> but errors['__all__']
>
> fixing 2) would also be ha
On Nov 23, 2007 9:42 AM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
>
> On Nov 23, 2007 3:28 PM, James Bennett <[EMAIL PROTECTED]> wrote:
> >
> > On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> > > looks cleaner in my eyes. opinions please!
> >
> > In my opinion, you're asking for a lo
On Nov 23, 2007 3:29 PM, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
>
> How do you clean a field that's supposed to be a date or a number, for
> example, if the user doesn't provide a legal date or number? If you're
> not allowed to throw validation errors during cleaning, you could find
> yourself i
On Nov 23, 2007 3:28 PM, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> > looks cleaner in my eyes. opinions please!
>
> In my opinion, you're asking for a lot of custom behavior from a
> default field type, and the fact that you have to do
How do you clean a field that's supposed to be a date or a number, for
example, if the user doesn't provide a legal date or number? If you're
not allowed to throw validation errors during cleaning, you could find
yourself in a situation where your later cleaning code makes
assumptions that aren't
On 11/23/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> looks cleaner in my eyes. opinions please!
In my opinion, you're asking for a lot of custom behavior from a
default field type, and the fact that you have to do some custom
coding to support that custom behavior is not a bug ;)
--
"Bu
We discussed this here again, and it looks like newforms currently
mixes cleaning and validating data in a not so ideal way.
Actually the clean and validation process should be separated, there
should be clean-methods and validate-methods. The process should work
in the following way, to allow fu
On Fri, 2007-11-23 at 14:45 +0100, Wolfram Kriesing wrote:
> On Nov 23, 2007 2:41 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote:
> > > :-) yep we also discussed that here
> > > still it seems "wrong" that it needs to be do
this has two drawbacks:
1) the URL is validated in the "wrong" place (in clean() instead of
clean_url())
2) the error, if one occurs, is not assigned to the errors['url']
but errors['__all__']
fixing 2) would also be hackish imho
wolfram
On Nov 23, 2007 2:28 PM, Matthias Kestenholz <[EMAIL P
But the problem is that the clean() method of the field already throws
a validationError, though i actually dont need to validate this field.
And that method simply comes first, no way around using the various
clean methods :-(
wolfram
On Nov 23, 2007 2:32 PM, Manakel <[EMAIL PROTECTED]> wrote:
On Nov 23, 2007 2:41 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote:
> > :-) yep we also discussed that here
> > still it seems "wrong" that it needs to be done with such a hacky way around
> >
>
> I don't think that's hacky at al
On Fri, 2007-11-23 at 14:30 +0100, Wolfram Kriesing wrote:
> :-) yep we also discussed that here
> still it seems "wrong" that it needs to be done with such a hacky way around
>
I don't think that's hacky at all, really. If you want an URLField, you
get a field that guarantees that it really co
Maybe you can remove the logic from the Field cleanMethod and add it
to the Form CleanMethod.
because i understand you want a validation based on the content of
several fields ?
I would try something like this:
- in Field "clean" method: validate data nature
ie mail address is really a mail adres
:-) yep we also discussed that here
still it seems "wrong" that it needs to be done with such a hacky way around
wolfram
On Nov 23, 2007 2:28 PM, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
>
> Hi Wolfram,
>
>
> On Fri, 2007-11-23 at 14:05 +0100, Wolfram Kriesing wrote:
> > I got an alike pro
this is what i currently have to do :(
if the clean_() function would get all the form-data that would
no be necessary!!
def __init__(self, *args, **kwargs):
data = len(args) and args[0] or kwargs['data']
# Copy the data first, so we can modify them,
copied = dict([(k,
Hi Wolfram,
On Fri, 2007-11-23 at 14:05 +0100, Wolfram Kriesing wrote:
> I got an alike problem, I ran through the docs, mailing lists, etc.
> but no solution.
>
> I got:
>
> class LinkForm(forms.Form):
> TYPE_CHOICES = (
> ('user', _('User link')),
> ('url', _('Web link')),
I got an alike problem, I ran through the docs, mailing lists, etc.
but no solution.
I got:
class LinkForm(forms.Form):
TYPE_CHOICES = (
('user', _('User link')),
('url', _('Web link')),
)
type = forms.ChoiceField(choices=TYPE_CHOICES)
user = forms.IntegerField(re
On 20-Nov-07, at 2:15 AM, Milan Andric wrote:
> self._errors['biz_zip_intl'] = [
> u'Please define a US State or
> International Zipcode.'
> ]
may be better to put:
raise forms.ValidationError('error message')
--
regards
kg
http://lawgon.l
On Nov 19, 12:30 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
> On Nov 19, 12:16 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
>
> > On Nov 19, 12:13 pm, RajeshD <[EMAIL PROTECTED]> wrote:
>
> > > > I would like to validate a field if another field is defined. So i
> > > > have two fields (state and
On Nov 19, 12:16 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
> On Nov 19, 12:13 pm, RajeshD <[EMAIL PROTECTED]> wrote:
>
> > > I would like to validate a field if another field is defined. So i
> > > have two fields (state and state (international) ) -- one of them
> > > needs to be defined. How
On Nov 19, 12:13 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> > I would like to validate a field if another field is defined. So i
> > have two fields (state and state (international) ) -- one of them
> > needs to be defined. How would i do this with newforms?
>
> By adding a clean() method to your
> I would like to validate a field if another field is defined. So i
> have two fields (state and state (international) ) -- one of them
> needs to be defined. How would i do this with newforms?
By adding a clean() method to your form class. See the 3rd cleaning
method described here:
http://w
Hello,
I would like to validate a field if another field is defined. So i
have two fields (state and state (international) ) -- one of them
needs to be defined. How would i do this with newforms?
Thanks and sorry if this is something obvious and I missed it.
--
Milan
--~--~-~--~~-
23 matches
Mail list logo