I read the django documentation, and I realised that both commands (  self.
__class__()._meta.get_field('{0}'.format(field_name)) and self._meta.
get_field(field_name) ) did return the right object, the problem was when I 
tried to access the verbose_name.
And after testing some more, I understood that it is because my verbose 
names have non ASCII caracters (for exemple, the verbose_name for phone is 
"N° de téléphone"), and that explains why it cancels the display of the 
whole string in which it is, and also why it doesn't raise an exception 
(because all the objects I want to access do exist).

So..it is a simple encoding problem...

Of course, in my models.py file was encoded with utf-8, but it wasn't 
enough.
I had to add an import : 

from __future__ import unicode_literals


(see 
https://docs.djangoproject.com/en/1.8/ref/unicode/#general-string-handling)

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52b65577-3ecf-4342-8086-9c9e28c1d39c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to