In the actual code, I'm taking input from 3rd party code which could be
None :(
I think the best option is to override clean_fields* *to check for
non-nullable fields that are null.
*
*
*
*
On 1 June 2012 17:26, Alasdair Nicol wrote:
> On 01/06/12 14:47, David Markey wrote:
>
> Hi All,
>
> S
On 01/06/12 14:47, David Markey wrote:
Hi All,
Say I have this model
class TestModel(models.Model):
my_test = models.CharField(max_length=512, blank=True)
And I try this:
In [1]: from core.base.models import TestModel
In [2]: test_model = TestModel()
In [3]: test_model.my_test =*""*
In
Hmm..
In my opinion, Model.full_clean() should catch this particular error.
On 1 June 2012 16:17, Kurtis Mullins wrote:
> It looks like the CharField is accepting 'none' in its to_python method.
> That might explain why we don't get the error until your to save it. I'm
> sure there is a rea
It looks like the CharField is accepting 'none' in its to_python method.
That might explain why we don't get the error until your to save it. I'm
sure there is a reason behind this -- I just don't know what it is :)
Source: django/db/models/fields/__init__.py
On Fri, Jun 1, 2012 at 11:08 AM, Kurti
Yeah, I'm getting exactly the same results. It seems that it's not throwing
the IntegrityError until you try to save it. I suppose that's because it's
marked as 'not null' in the database. It appears to be ignoring it in the
actual clean() (and consequently clean_fields()) methods. I'm going to loo
1.4
On 1 June 2012 15:54, Kurtis Mullins wrote:
> What version of Django are you using?
>
>
> On Fri, Jun 1, 2012 at 10:47 AM, David Markey wrote:
>
>> That is my exact class for that model.
>>
>>
>> On 1 June 2012 15:27, Kurtis Mullins wrote:
>>
>>> From the docs:
>>> https://docs.djangoproje
What version of Django are you using?
On Fri, Jun 1, 2012 at 10:47 AM, David Markey wrote:
> That is my exact class for that model.
>
>
> On 1 June 2012 15:27, Kurtis Mullins wrote:
>
>> From the docs:
>> https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.
That is my exact class for that model.
On 1 June 2012 15:27, Kurtis Mullins wrote:
> From the docs:
> https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.full_clean
>
> from django.core.exceptions import ValidationError, NON_FIELD_ERRORStry:
> arti
>From the docs:
https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.full_clean
from django.core.exceptions import ValidationError, NON_FIELD_ERRORStry:
article.full_clean()except ValidationError as e:
non_field_errors = e.message_dict[NON_FIELD_E
Hi All,
Say I have this model
class TestModel(models.Model):
my_test = models.CharField(max_length=512, blank=True)
And I try this:
In [1]: from core.base.models import TestModel
In [2]: test_model = TestModel()
In [3]: test_model.my_test =* ""*
In [4]: test_model.full_clean()
In [5]: t
10 matches
Mail list logo