Hi list

I'm trying to use Django 1.7.2 with an Oracle 11.2 backend. THis backend 
uses RAW(16) fields as primary keys everywhere (it wasnt my choice).
THis is however giving me major headaches, as Django seems to insist on 
decoding these keys to text.

Here''s my models:
#models.py
from django.db import models
#from uuidfield import UUIDField
from django_extensions.db.fields import UUIDField


class Population(models.Model):
    population_id = UUIDField(primary_key=True) 
    population_name = models.CharField(max_length=400,)
    population_cross = models.ForeignKey('PopulationCross')

    class Meta:
        managed = False
        db_table = 'population'

class PopulationCross(models.Model):
    population_cross_id = UUIDField(primary_key=True)  
    population_cross = models.CharField(max_length=100)

    class Meta:
        managed = False
        db_table = 'population_cross'


#--------------------------------------------------------------
#code
from .models import Population


x=Population.objects.all()[0]
x.population_cross
-------------------------------------------------
This last command yields:
django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode 
byte 0xe9 in position 6: invalid continuation byte. You passed in 
'\nD\t\x025W\xe9\xc2\xe0SW\x99\x03\n\x0cc' (<type 'str'>)

so for some reason UUIDfield presents itself as a string and it crashes the 
decode() statement internal in Django

* Using the uuid field module is not an improvement. 
* using Char fields also crashes
* using BinaryField works, but may give me misery later on.
 
I apologize if this is a known issue but I spent a day searching and found 
no solution. 
So my questions are:
* Is using BinaryField the only solution here?
* Will BinaryField put in in other trouble elsewhere?
* would the UUIDfield in dev solve my problems?

Any pointer are very welcome. As mentioned, I have no control over the 
decision to use RAW(16) as primary keys.

Sincerely
Joris

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/1afa922b-4eb5-4f28-a5c2-1d399067d18f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to