Re: Remove null assingment check for non-nullable fields?

2016-02-03 Thread Tim Graham
You're probably think of the change in 1.8.4 that moved the unsaved model instance assignment data loss check (added in Django 1.8) to Model.save() to allow easier usage of in-memory models (#25160 ). The checks in question have been in Django since

Re: Remove null assingment check for non-nullable fields?

2016-02-03 Thread Florian Apolloner
On Wednesday, February 3, 2016 at 12:26:26 AM UTC+1, Tim Graham wrote: > > There's a proposal to remove this behavior: > > > >>> obj.fk = None > ValueError('Cannot assign None: "Obj.fk" does not allow null values.) > Yes please, if you do IntegerField(null=False) you can still do instance.xxx = N

Re: Remove null assingment check for non-nullable fields?

2016-02-02 Thread Anssi Kääriäinen
On Wednesday, February 3, 2016 at 1:26:26 AM UTC+2, Tim Graham wrote: > > There's a proposal to remove this behavior: > > > >>> obj.fk = None > ValueError('Cannot assign None: "Obj.fk" does not allow null values.) > I don't see this check as necessary - if you try to save such an object you will

Re: Remove null assingment check for non-nullable fields?

2016-02-02 Thread Dheerendra Rathor
With respect to rationale 2: It makes sense to remove this check as database handle these checks very well. And just like uniqueness checks, it is nice to let database do its work. With respect to rationale 1: Since this behaviour will ask developers to change exception catching from ValueError to

Remove null assingment check for non-nullable fields?

2016-02-02 Thread Tim Graham
There's a proposal to remove this behavior: >>> obj.fk = None ValueError('Cannot assign None: "Obj.fk" does not allow null values.) (i.e. no more exception if you assign None to a non-nullable foreign key) Rationale presented on the ticket [1]: - Conceptually it is a programmer's respon