Re: Validators and django.contrib.postgres.fields JSONField

2016-08-28 Thread Ryan Causey
Ah! Fantastic! I love it when I make a dumb mistake because it's an easy solution! Instead of: class DummyModel(models.Model): dummyJson = JSONField(validators = [TestValidator])#Using class, wrong! I should be doing: class DummyModel(models.Model): dummyJson = JSONField(validators = [T

Re: Validators and django.contrib.postgres.fields JSONField

2016-08-28 Thread Daniel Roseman
On Sunday, 28 August 2016 07:54:47 UTC+1, Ryan Causey wrote: > > So I've dug into this a little more, and I've come up with the debugger > trace below. > > -> dummyModelInstance.full_clean() > c:\program files\python35\lib\site-packages\django\db\models\base.py( > 1210)full_clean() > -> self.cle

Re: Validators and django.contrib.postgres.fields JSONField

2016-08-27 Thread Ryan Causey
So I've dug into this a little more, and I've come up with the debugger trace below. -> dummyModelInstance.full_clean() c:\program files\python35\lib\site-packages\django\db\models\base.py(1210) full_clean() -> self.clean_fields(exclude=exclude) c:\program files\python35\lib\site-packages\dja

Re: validators not working in shell

2014-07-13 Thread alghafli
Thank you. That helped me solving the problem :) على السبت 12 تـمـوز 2014 20:12, كتب tim: Model validation is not invoked when calling model.save(). You can read more here: https://docs.djangoproject.com/en/1.6/ref/models/instances/#validating-objects On Saturday, July 12, 2014 6:46:17 AM UTC-

Re: validators not working in shell

2014-07-12 Thread tim
Model validation is not invoked when calling model.save(). You can read more here: https://docs.djangoproject.com/en/1.6/ref/models/instances/#validating-objects On Saturday, July 12, 2014 6:46:17 AM UTC-4, thebsom wrote: > > Hello > I am creating a django library application. I have made a bo

Re: Validators for fields in Proxy Model - possible without monkeypatching?

2012-01-17 Thread Kirill Panshin
I've found the solution, initially I was looking in wrong direction. All I needed to do is to use ``Model.clean()`` method and then call ``Model.full_clean()`` in ``save()``: from django.contrib.auth.models import User class CustomUser(User) def clean(self): """ Clean username field t

Re: Validators for fields in Proxy Model - possible without monkeypatching?

2012-01-16 Thread Matt Schinckel
You can probably use a form to do most of what you want, with the caveat that as long as your restrictions are more restrictive than any db constraints that auth.User puts in there are. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view t

Re: Validators

2007-10-09 Thread jacoberg2
Thanks for the update! On Oct 9, 1:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-10-09 at 10:44 -0700, jacoberg2 wrote: > > I have regular and custom validators in my models. > > I also have a custom manipulator in my view, so i can get the field > > data in a > > form. Is i

Re: Validators

2007-10-09 Thread Malcolm Tredinnick
On Tue, 2007-10-09 at 10:44 -0700, jacoberg2 wrote: > I have regular and custom validators in my models. > I also have a custom manipulator in my view, so i can get the field > data in a > form. Is it necessary to put the validators in the custom manipulator > in order > to dynamically present the

Re: [validators] - access to object.id field

2006-12-01 Thread Ivan Sagalaev
Marcin Jurczuk wrote: > Hello, > I'm writing my own validator based on shipped with django and wondering > how get validated object.id field ? Validators come in two varieties: those linked to field definitions in models and those that linked to field definitions in custom manipulators. With fi

Re: Validators in a model's validator_list (m-r)

2006-04-26 Thread Christian Schneider
Good morning,On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: I don't know what you mean with "stop". I think each validator will beexecuted, but they will take into account whether record_type has theright value.Anyway, I personally give up :-( You can try to find out what's happening:- crea

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Christian Schneider
On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: Christian Schneider wrote:> On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: Christian Schneider wrote:>>> Michael,>>> >>> I'm still using a generic view. I played with some custom functions>> before>>> and they were called so I'd hop

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Michael Radziej
Christian Schneider wrote: > On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: >> >> Christian Schneider wrote: >>> Michael, >>> >>> I'm still using a generic view. I played with some custom functions >> before >>> and they were called so I'd hoped that it would work with the validator >>> ob

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Christian Schneider
On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: Christian Schneider wrote:> Michael,>> I'm still using a generic view. I played with some custom functions before> and they were called so I'd hoped that it would work with the validator > objects as well.I looked in the source. Aha! First para

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Michael Radziej
Christian Schneider wrote: > Michael, > > I'm still using a generic view. I played with some custom functions before > and they were called so I'd hoped that it would work with the validator > objects as well. I looked in the source. Aha! First parameter to RequiredIfOtherField is the *name* of

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Christian Schneider
Michael,I'm still using a generic view. I played with some custom functions before and they were called so I'd hoped that it would work with the validator objects as well.Regardschris On 4/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote: Christian Schneider wrote:> However, no matter what value re

Re: Validators in a model's validator_list (m-r)

2006-04-25 Thread Michael Radziej
Christian Schneider wrote: > However, no matter what value recording_type has, the validator is not > called. What I find funny is that the validator's __call__ method takes > three values (self, field_data, all_data) while custom validator functions > specified with validator_list take only field

Re: validators combined

2006-01-30 Thread Jiri Barton
Thank you very much. This is exactly what I've been looking for.

Re: validators combined

2006-01-30 Thread Adrian Holovaty
On 1/30/06, Jiri Barton <[EMAIL PROTECTED]> wrote: > I have two text input fields in a form. At least one of them is > required. My question is, how can I check for this? Hi Jiri, Check out RequiredIfOtherFieldNotGiven and RequiredIfOtherFieldsGiven in django/core/validators.py. Adrian -- Adri

Re: validators 9.1

2006-01-17 Thread Adrian Holovaty
On 1/17/06, David S. <[EMAIL PROTECTED]> wrote: > I have some custom validation I want only on adding a record, not changing it. > Is there a way to qualify my _manipulator_validate_FOO() method or to find out > from within it if it is an add or change? I know I can create a custom > manipulator

Re: validators 9.1

2006-01-17 Thread Matthew Flanagan
On 1/18/06, David S. <[EMAIL PROTECTED]> wrote: > > I have some custom validation I want only on adding a record, not changing it. > Is there a way to qualify my _manipulator_validate_FOO() method or to find out > from within it if it is an add or change? I know I can create a custom > manipulato