Re: Encoding problem (Postgres)

2016-03-06 Thread Georges H
OK thanks for this informations. Yes I would like P3, but it is my host, for the moment. Cordially Le dimanche 6 mars 2016 20:30:14 UTC+1, luisza14 a écrit : > > The problem is in your __str__() function, because Python 2 use > __unicode__() instead of str to return Unicode string. By default p

Encoding problem (Postgres)

2016-03-06 Thread Luis Zárate
The problem is in your __str__() function, because Python 2 use __unicode__() instead of str to return Unicode string. By default p2 return bytes in __str__ and p3 return Unicode. python_2_unicode_compatible works and I thing it is the best approach because you are support both version 3/2 . I re

Re: Encoding problem (Postgres)

2016-03-06 Thread Georges H
OK thanks Without the python_2_unicode_compatible decorator before my class, it does not work. Le dimanche 6 mars 2016 14:11:41 UTC+1, Vijay Khemlani a écrit : > > Do you know why you had the problem in the first place or are you just > copy-pasting code? > > If you only need to support one ver

Re: Encoding problem (Postgres)

2016-03-06 Thread Vijay Khemlani
Do you know why you had the problem in the first place or are you just copy-pasting code? If you only need to support one version of Python (either 2.x or 3.x) there is no need to use the python_2_unicode_compatible decorator On Sun, Mar 6, 2016 at 8:14 AM, Georges H wrote: > OK Thanks but I so

Re: Encoding problem (Postgres)

2016-03-06 Thread Georges H
OK Thanks but I solved this little problem by adding at the top of my models.py: django.utils.encoding import from python_2_unicode_compatible And always in models.py before each class: @ python_2_unicode_compatible Perfect! Le dimanche 6 mars 2016 03:16:35 UTC+1, Vijay Khemlani a écrit : >

Re: Encoding problem (Postgres)

2016-03-05 Thread Vijay Khemlani
The error you are seeing is at the application level, not database, so I don't think postgres is at fault. Post the full stack trace for the error and the relevant part of your code when it fails. On Sat, Mar 5, 2016 at 3:28 PM, Georges H wrote: > Hi to all the Django community ! > > I started

Encoding problem (Postgres)

2016-03-05 Thread Georges H
Hi to all the Django community ! I started with Django. I have a small form that works pretty well, and that will store the data in a Postgres database, that's fine. OK, except that when I have a special character to enter (like an accent, I am french), I get an error (No problem without spec