yml wrote:
> I guess that I should add something to my script called
>loader_departments.py in order to support this.
>
>
Yes. You are getting contents of your file in unicode but Django's ORM
expect strings to be in byte strings. So you have to encode them into
whatever encoding your DB is right before you pass them to a model
constructor.
This:
>r=Department(department=matches[1],department_number=matches[0],country="France")
> r.save()
>
>
becomes this (assuming your DB in utf-8):
r=Department(
department=matches[1].encode('utf-8'),
department_number=matches[0].encode('utf-8'),
country="France"
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---