Re: __init__ custom form validation

2010-07-13 Thread Scott Gould
Your init is expecting a value for field3_type, so you need to provide it when you create the form in your view (prior to request.POST in the postback instance). On Jul 12, 2:44 pm, Nick wrote: > I am working on a validation that will require a field be filled in if > it is another field enters o

__init__ custom form validation

2010-07-12 Thread Nick
I am working on a validation that will require a field be filled in if it is another field enters on of three values: For example: I have a form class myform(forms.Modelform): field1 = forms.CharField field2 = forms.Charfield field3_type = forms.CharField(choices=choices) field3

Re: Custom form validation request or user-based

2009-09-02 Thread Daniel Roseman
On Sep 2, 10:59 am, Matthias Kestenholz wrote: > On Wed, Sep 2, 2009 at 10:38 AM, Enrico > > Sartorello wrote: > >> if you need this only for the administration site you'd hvae other > >> hooks that you could override. Either take a look at the documentation > >> or at django/contrib/admin/option

Re: Custom form validation request or user-based

2009-09-02 Thread Matthias Kestenholz
On Wed, Sep 2, 2009 at 10:38 AM, Enrico Sartorello wrote: >> if you need this only for the administration site you'd hvae other >> hooks that you could override. Either take a look at the documentation >> or at django/contrib/admin/options.py >> > > If you mean overriding the ModelAdmin.form objec

Re: Custom form validation request or user-based

2009-09-02 Thread Enrico Sartorello
On Wed, Sep 2, 2009 at 10:25 AM, Matthias Kestenholz wrote: > > On Wed, Sep 2, 2009 at 9:15 AM, Enrico > Sartorello wrote: > > Up. > > > > Already? > > Yes, cause it seemed to me that a message buried by other 30 messages was about to be left unanswered :-) > > > > > On Tue, Sep 1, 2009 at 11:

Re: Custom form validation request or user-based

2009-09-02 Thread Matthias Kestenholz
On Wed, Sep 2, 2009 at 9:15 AM, Enrico Sartorello wrote: > Up. > Already? > On Tue, Sep 1, 2009 at 11:06 AM, Enrico Sartorello > wrote: >> >> Wait a moment: this solution doesn't solve my problem. >> Remember that the form I need has to be used on the admin site, so I can't >> deal with it dir

Re: Custom form validation request or user-based

2009-09-02 Thread Enrico Sartorello
Up. On Tue, Sep 1, 2009 at 11:06 AM, Enrico Sartorello < enrico.sartore...@gmail.com> wrote: > Wait a moment: this solution doesn't solve my problem. > Remember that the form I need has to be used on the admin site, so I can't > deal with it directly (in fact, I can't instantiate it and provide >

Re: Custom form validation request or user-based

2009-09-01 Thread Enrico Sartorello
Wait a moment: this solution doesn't solve my problem. Remember that the form I need has to be used on the admin site, so I can't deal with it directly (in fact, I can't instantiate it and provide additional arguments). Are there any other way to accomplish that? On Tue, Sep 1, 2009 at 10:48 AM,

Re: Custom form validation request or user-based

2009-09-01 Thread Enrico Sartorello
Thank you very much, your solution is simple and efficient :-) On Mon, Aug 31, 2009 at 10:57 PM, Matthias Kestenholz < matthias.kestenh...@gmail.com> wrote: > > On Fri, Aug 28, 2009 at 10:34 AM, Enrico > Sartorello wrote: > > Hi, > > i'm developing a Django application where i need to differentia

Re: Custom form validation request or user-based

2009-08-31 Thread Matthias Kestenholz
On Fri, Aug 28, 2009 at 10:34 AM, Enrico Sartorello wrote: > Hi, > i'm developing a Django application where i need to differentiate the > validation of an admin-site model form between different users: some user > must respect some particular restrictions (imposed via "clean_*" methods) > while o

Re: Custom form validation request or user-based

2009-08-31 Thread Enrico Sartorello
Up. On Fri, Aug 28, 2009 at 10:34 AM, Enrico Sartorello < enrico.sartore...@gmail.com> wrote: > Hi, > i'm developing a Django application where i need to differentiate the > validation of an admin-site model form between different users: some user > must respect some particular restrictions (impo

Custom form validation request or user-based

2009-08-28 Thread Enrico Sartorello
Hi, i'm developing a Django application where i need to differentiate the validation of an admin-site model form between different users: some user must respect some particular restrictions (imposed via "clean_*" methods) while others should do what they want without them. The problem arises becau

custom form validation in newforms-admin

2008-06-05 Thread Mackenzie Kearl
I am using newforms admin and need to be able to have a validation check against multiple fields on the form. I was reading that all you need to do is to go form_change = MyCustomForm() from within your subclass of admin.ModelAdmin however it seems like this has changed since the post that I re

Re: Custom Form Validation

2007-06-22 Thread Nathaniel Whiteinge
Sorry, accidentally hit the submit button. Here's your example finished (don't forget self in the def!): def clean_lines(self): if not format_is_correct( lines ): raise forms.ValidationError('Bug..') return self.cleaned_data.get(lines) Good luck! - whiteinge On Jun 22, 4:54 pm

Re: Custom Form Validation

2007-06-22 Thread Nathaniel Whiteinge
You're nearly there, you just need to return your cleaned value. Here's one of mine: if self.cleaned_data.get(field_name) > assets.get_usable_assets(): raise ValidationError(u'You only have %s points available for betting.' % assets.get_usable_assets()) return self.cleaned_data.get(f

Custom Form Validation

2007-06-22 Thread Mario Gonzalez
Hello, I've got a model like: class RecepcionForm(forms.Form): drivers = forms.ModelChoiceField(queryset=Driver.objects.all().order_by('- name')) lines = forms.CharField() def clean_lines(): if not format_is_correct( lines ): raise forms.

Re: custom form, validation, is there an easier way?

2006-01-13 Thread Daniel Ericsson
On 13 jan 2006, at 13.15, Gábor Farkas wrote: 2. forms/manipulators: again, there are auto-created manipulators for database-models, but for my needs there is need for a custom one. yes, i can create a custom validator, but is that simpler than to simply do all the validating by myself?

custom form, validation, is there an easier way?

2006-01-13 Thread Gábor Farkas
hi, i am implementing a VERY simple usermanagement screen for the admin view. functionality: create new user, change existing user, delete user. for an user, the following data is "available": username, password, groups. so when they create/change an user, they can change the username, the