Looking at the log it seems your underliying database has DATE type
for the column when it should be a VARCHAR or the like

2012/1/9 Nikhil Verma <varma.nikhi...@gmail.com>:
> Hi
>
> I am having a requirement that i have to encrypt some of the fields in a
> table.
> I am using Django 1.3.1 and postgres 9.1. I am referring to this app
> django-fields :-
>
> https://github.com/svetlyak40wt/django-fields/blob/master/src/django_fields/fields.py
>
> Here is my code :-
>
>     patient_type = EncryptedCharField(max_length=80,
> choices=CHOICES.PATIENT_TYPES)
>     date_of_birth = EncryptedDateField(null=True, blank=True)
>     gender = EncryptedCharField(max_length=1024, choices=CHOICES.GENDERS,
> blank=True)
>     contact_phone = EncryptedCharField(max_length=1024, blank=True)
>     security_question = models.ForeignKey(SecurityQuestion, null=True,
> blank=True)
>     security_answer = EncryptedCharField(max_length=1024, null=True,
> blank=True)
>
> It stores everything in encrypted form in the database except
> date_of_birth.It throws this error
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
>   111.                         response = callback(request, *callback_args,
> **callback_kwargs)
> File
> "/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/utilities/decorators.py"
> in _dec
>   14.             return view_func(request, *args, **kwargs)
> File
> "/home/user/slave/old_careprep/CPMS-Source/careprep/../careprep/visit/views.py"
> in setup
>   202.                 patient.save()
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
> save
>   460.         self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in
> save_base
>   553.                     result = manager._insert(values,
> return_id=update_pk, using=using)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in
> _insert
>   195.         return insert_query(self.model, values, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in
> insert_query
>   1436.     return query.get_compiler(using=using).execute_sql(return_id)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in
> execute_sql
>   791.         cursor = super(SQLInsertCompiler, self).execute_sql(None)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in
> execute_sql
>   735.         cursor.execute(sql, params)
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in
> execute
>   34.             return self.cursor.execute(sql, params)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
> in execute
>   44.             return self.cursor.execute(query, args)
>
> Exception Type: DatabaseError at /visit/setup/
> Exception Value: invalid input syntax for type date:
> "$AES$55403376ed906e119b0f7779554fbb51"
> LINE 1: ...L, NULL, '$AES$0452edae035cc33c4084e7b0fb39edd7', '$AES$5540...
>                                                              ^
> Any help will be appreciated.
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to