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 handy as then you could use all sorts of the powerful
features in a DB.
I get that it may then make the use of an ORM less "useful", but it sure
would be easier than having to always due RAW sql calls on the object to
get the same result.


On Fri, May 3, 2013 at 8:37 AM, Marc <war...@gmail.com> 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 and they don't seem to
> manipulate the query that is built by django, just the value passed.
>
> What isn't obvious in the Doc's Shawn is what is passed into and what is
> expected to be returned. The docs are not clear at all about that at all.
>
>
>
> On Fri, May 3, 2013 at 8:12 AM, Tom Evans <tevans...@googlemail.com>wrote:
>
>> On Fri, May 3, 2013 at 12:46 PM, Shawn Milochik <sh...@milochik.com>
>> 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 these two methods of a custom field. You can pretty
>> easily
>> > make your own.
>> >
>> > You can use this as an example (see the EncryptedCharField class):
>> >
>> > http://djangosnippets.org/snippets/2489/
>> >
>>
>> This deals with decrypting in python an encrypted value retrieved from
>> the database (and vice-versa). The OP wants to decrypt the value in
>> the database, which afaict is not possible easily.
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/6BQxdM04Hi0/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

-- 
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, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to