I went ahead and hardcoded checks for fields that as of today I know
will only be in one of the models. I would still love to hear any
cleaner solutions if anyone has them.
On Aug 26, 10:12 am, John wrote:
> Any ideas?
>
> In the inline model's validation I could hardcode checks for data that
> I
Any ideas?
In the inline model's validation I could hardcode checks for data that
I expect will only be in one of the models, but that does not seem
like the best option. I am still hoping for a simpler alternative to
this.
Thanks.
--
You received this message because you are subscribed to the
Overriding the clean method of the modelform is the way to go.
If you're getting an error about not having 'cleaned_data,' it could be because
your custom clean method doesn't return anything -- you're responsible for
returning it if you override it that method.
Shawn
--
You received this me
try this...
from django.forms import ValidationError
...
for form in self.forms:
...
raise ValidationError('whatever')
On Oct 11, 1:32 pm, Duane Hilton wrote:
> Changing forms to form brings a new error:
>
> *Exception Value: 'CandidateFeedForm' object has no attribute
> 'Validation
Changing forms to form brings a new error:
*Exception Value: 'CandidateFeedForm' object has no attribute
'ValidationError'*
Below is the view that is using the BaseCandFormSet code that I included in
the original message. Maybe something is wrong in it? Thanks in advance for
your suggestions. I'v
? 11 ?.?. 2553 23:44 Duane Hilton ?:
> Hi all,
>
> I'm trying to do some custom validation on a model formset, but I'm
> not having good luck. Thank you in advance for your suggestions ...
>
> In my views, I have:
>
> class BaseCandFormSet(BaseModelFormSet):
>def clean(self):
>
Hi, Malcolm...
Thanks a lot... It is working Now..
On Apr 7, 12:05 pm, Malcolm Tredinnick
wrote:
> On Mon, 2009-04-06 at 23:58 -0700, Harish wrote:
>
> [...]
>
> > If salary is found negative it displays the error message in beginning
> > of the form(that is after the message 'Please correct
On Mon, 2009-04-06 at 23:58 -0700, Harish wrote:
[...]
> If salary is found negative it displays the error message in beginning
> of the form(that is after the message 'Please correct the error below.
> '). Actually it should display the error message in the 'Salary'
> section
>
> I think, I am m
Thanks Alex that's exactly what I was looking for!
Paddy
On Apr 5, 10:40 am, Alex Gaynor wrote:
> On Sat, Apr 4, 2009 at 8:37 PM, Paddy Joy wrote:
>
> > I need to validate some data from a form however I need access to the
> > request object as the data validation will be different depending o
On Sat, Apr 4, 2009 at 8:37 PM, Paddy Joy wrote:
>
> I need to validate some data from a form however I need access to the
> request object as the data validation will be different depending on
> the logged on user.
>
> What is the preferred method for this type of validation? Can i
> validate th
Perfect. Thank you!
On Thu, Mar 19, 2009 at 3:36 PM, Alex Gaynor wrote:
>
>
> On Thu, Mar 19, 2009 at 3:31 PM, Michael Repucci wrote:
>
>>
>> I'm struggling with what seems like should be a very straightforward
>> task. I have a model with a field named image of type ImageField, and
>> I'd like
On Thu, Mar 19, 2009 at 3:31 PM, Michael Repucci wrote:
>
> I'm struggling with what seems like should be a very straightforward
> task. I have a model with a field named image of type ImageField, and
> I'd like to do custom validation via the model form's clean_image
> method based on the height
Well, as i said, overriding save() does not provide the ability to
raise an error which is field-specific.
What i want to do, was possible with validator_list. I actually don't
understand why this functionality has been removed.
On Mon, Jul 21, 2008 at 7:59 PM, Jeff FW <[EMAIL PROTECTED]> wrote:
The point is that i see this validation as tied to the model, not to a
specific form. For me this as an integrity check, something which
should be done at model level.
On Mon, Jul 21, 2008 at 3:20 PM, Jeff FW <[EMAIL PROTECTED]> wrote:
>
> Sounds like you're looking at the oldforms documentation-
Sounds like you're looking at the oldforms documentation--that's all
been deprecated. Read this instead:
http://www.djangoproject.com/documentation/newforms/
Especially this part:
http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation
-Jeff
On Jul 21, 8:14 am, "A
The following did it for me:
from django import newforms as forms
class yourForm(forms.BaseForm):
...
def clean(self):
"do your custom validation here"
return self.cleaned_data
does it for me.
Clean is called automatically e.g. by ...is_valid().
hope it helps.
jr
On Sep 11, 10
Hi Mike,
I have the same problem with my model. (Link below)
Reading your "points to a .validate() on the model" raises the
following question.
Have you tried it?
http://groups.google.com/group/django-users/browse_thread/thread/bd2b2c24f3879690
--~--~-~--~~~---~--~-
Sorry, I should have said that I'd already tried a custom validator.
Unfortunately, validators don't provide the functionality I need.
I need to check in the database to see if there are any pages, other
than the one I am saving, that have start and end dates that overlap
with the one I am sa
You need to write a validator and use validator_list in the field
attributes to do custom validation in admin.
http://www.djangoproject.com/documentation/model-api/#validator-list
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
19 matches
Mail list logo