Answer the question
In order to leave comments, you need to log in
How to put value from field of type BinaryField into JS variable in template?
Good afternoon.
The postgresql database is connected to the django project, the model has a field with the type BinaryField, respectively, in the database this field is with the bytea type, the question is: how to transfer the value of the field with the bytea type to javascript in templates?
Django displays the field in the format "memory at 0x03B5F308", passes it in the same form to the JS variable, how to achieve the transfer of the string in binary form to the JS variable?
Answer the question
In order to leave comments, you need to log in
Depending on your needs:
select encode (my_field, 'hex') as my_bytes from my_table
select encode (my_field, 'base64') as my_bytes from my_table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question