Thursday, February 23, 2017

Re: Issues saving hex format data to binaryfield

On Thursday 23 February 2017 13:06:31 ludovic coues wrote:

> Notice how Brian print self.rfid before and after affecting the new

> value. The second print should display the updated data. As it is not

> the case, I highly doubt save will change the value in db.

 

The two prints are different. How did you assert that they're not updated?

 

> Ok, look like I misread the code when writing my previous reply.

> Now I'm all curious about how did you find about the editable argument

> and why you set it.

> About your problem, django's BinaryField is not editable. Here is the

> source for django 1.10.5 [1]

> Notice how the init method override your argument ? I haven't checked

> further but I'm pretty sure

> it explain the issue you have noticed.

 

Editability is a hint for forms, nothing more. Doesn't affect the operation of save, not even Model(not_editable_value='foo').

It merely means, that you will implement saving the value without the help of ModelForm.

 

--

Melvyn Sopacua

No comments:

Post a Comment