On Sat, Apr 26, 2008 at 1:56 PM, plamen.dragozov <[EMAIL PROTECTED]> wrote:
> > Hi, > I'm having a realy weird problem. I created Django models for some > legacy data and I'm doing some tests on Windows XP with Django 0.96.1 > and sqlite. > I'm parsing the data (a few big CSV text files) and generating a JSON > fixture file, which I use to initialize the database. The file is > quite big (~250 MB) and Django's error messages are not very helpful, > so it took me a few hours of head-scratching until I found out what's > wrong, but I managed to reduce it to the simple problem bellow: > 1. An application "testapp" > 2. A models.py file: > > ## -*- coding: utf-8 -*- > > from django.db import models > > class Test(models.Model): > #id = models.PositiveIntegerField(primary_key=True) > f1 = models.CharField(maxlength=65, blank=True, null=True) > > 3. A test.json file: > > [{"pk": "203", "model": "testapp.Test", > "fields": > {"f1": "\u00c3"}}] > > 4. I delete the db file and then from the command line I run: > python manage.py syncdb testapp > python manage.py loaddata fixtures/test.json > > If I leave the line with the custom primary key commented everything > is fine and I get: > Installed 1 object(s) from 1 fixture(s) > > However if I use a custom primary key, i.e. uncommented the line in > models.py I get an error: > Problem installing fixture 'fixtures/test.json': 'ascii' codec can't > decode byte 0xc3 in position 0: ordinal not in range(128) > > It's really strange, as I'm not changing anything else and can't see > how the type of the primary key has any connection to the database > unicode support. > Any ideas? Is it a known problem and is it SQLite only? > One thing: the Django 0.96 release is not fully unicode enabled. Full unicode support did not arrive until after the 0.96 release, so if you want unicode support you need to be using an SVN checkout, not one of the older releases. Now, I don't know why you'd get the results you are describing, with a problem only when you override the primary key specification, but I doubt you will find anyone interested in investigating a unicode problem on the 0.96 release, so your first step needs to be an upgrade to a unicode-enabled version. Then, if the problem does not just go away, post again and someone will likely be able to help. Karen --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---