Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 10:22 AM, Marc wrote: Thanks. I understood and that doesn't work for my project as python/django > can't handle the returned bytes I need to use. > my project requires that the values are stored using the result of > aes_encrypt from MySQL because other systems not made in

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
Thanks. I understood and that doesn't work for my project as python/django can't handle the returned bytes I need to use. my project requires that the values are stored using the result of aes_encrypt from MySQL because other systems not made in python expect that and cannot be changed at this stag

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:37 AM, Marc wrote: So Tom: i can't use those methods Shawn pointed out? What I was hoping I > can do is override the code that builds the SQL query. > Further looking I think thats correct; as I did get a module working I > found and played with which uses those methods

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
I really think django should add an easy way to override what django uses to build the query for each Field and make it part of the Field settings, for example: models.CharField(override_sql_newupdate='AES_ENCRYPT(fieldname,key)', override_sql_select='AES_DECRYPT(fieldname,key)',... would be very

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
So Tom: i can't use those methods Shawn pointed out? What I was hoping I can do is override the code that builds the SQL query. Further looking I think thats correct; as I did get a module working I found and played with which uses those methods and they don't seem to manipulate the query that is

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 12:46 PM, Shawn Milochik wrote: > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-objects > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-python-objects-to-query-values > > Have a look at the

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:06 AM, Marc wrote: Thanks, i'll play with that and see what I can come up with. > Docs are good, but sometimes really hard to read/find what you need :) > > > > Oh come on, you mean "get_prep_value" and "to_python" weren't obvious? ;o) -- You received this message becau

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
Thanks, i'll play with that and see what I can come up with. Docs are good, but sometimes really hard to read/find what you need :) On Fri, May 3, 2013 at 7:46 AM, Shawn Milochik wrote: > > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-obj

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-objects https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-python-objects-to-query-values Have a look at these two methods of a custom field. You can pretty easily make yo

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc R
Anyone? I would really like to know who I can modify the query as its being built so that for a specific field I can set the "field" to AES_DECRTYP(fieldname,key) on a select and AES_ENCRYPT(fieldname,key) on insert/update On Sunday, 28 April 2013 20:21:48 UTC-4, Marc R wrote: > > I have a mode

Admin module - modify SQL Query used for Edit and Save Models

2013-04-28 Thread Marc R
I have a model where I have used AES_ENCRYPT(value, key) to save data in a MySQL database. It is set as a varbinary field. So the issue is; when trying to edit the model in Django, it does not render a widget for the field. I've tried the aesfield from github but that does some funky thing wit