Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
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 di

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread ludovic coues
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. Ok, look like I misread the code when writing my previous reply. Now I'm all curious about how did y

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
On Wednesday 22 February 2017 14:47:55 Brian O'Connell wrote: > def set_rfid(self,rfid_new): > print self.rfid # print the existing object data > try: > self.rfid = bytearray(rfid_new) > print self.rfid > except Exception as ex: > tem

Re: Issues saving hex format data to binaryfield

2017-02-22 Thread ludovic coues
As you have editable = True, I assume you have read the code a bit. I personnaly stopped reading after RegisterLookupMixin. If looking at the code don't give you a solution, I would try to fallback to raw SQL. That might be a skill more useful than the ability to update BinaryField :) 2017-02-22 2

Re: Issues saving hex format data to binaryfield

2017-02-22 Thread Brian O'Connell
The database is pre-existing and I'm creating a Django web interface for it. This object holds the 8-digit hex output of the unique mfr identifier of the MiFare rfids. There are remote terminals that interact with database through psycopg2 and have no issue with that field. I could change the

Re: Issues saving hex format data to binaryfield

2017-02-22 Thread Brian O'Connell
I have the model set up as a binaryfield. The problem is I have no idea how to save the information to it. I can retrieve information from it easy enough but if I try and enter in new information, saved in the same format as that it returns Here's what I have in model.py class Users(models.Mod

Re: Issues saving hex format data to binaryfield

2017-02-22 Thread ludovic coues
Can't you use django's BinaryField ? 2017-02-22 20:09 GMT+01:00 Shawn Milochik : > Why not base64 encode it and just store it in a charfield? There doesn't > seem to be any compelling reason to store it in binary. > > -- > You received this message because you are subscribed to the Google Groups >

Re: Issues saving hex format data to binaryfield

2017-02-22 Thread Shawn Milochik
Why not base64 encode it and just store it in a charfield? There doesn't seem to be any compelling reason to store it in binary. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, se

Issues saving hex format data to binaryfield

2017-02-22 Thread Brian O'Connell
I have a project where I am saving RFID information (which comes in as hex strings) to a bytea object in my postgres database. I can retrieve this information without issue. I am struggling to overwrite that object with new data (For when someone loses their rfid and needs to replace it). I hav