skins96 wrote:
> Hi,
> 
> I'm a noob who is struggling with understanding how Django might work
> with legacy data.
> 
> It seems Django's foreign keys rely on having an integer in both the
> parent and child table. However, we get a lot of data where what's
> needed is a join based on characters. For instance, "wht" in the
> parent table would correspond to "wht" in the child table, which then
> has a description field that might have, say, "white" in this
> instance.
> 
> I've looked through tons of documentation, both the Sam's book and the
> DjangoBook, but can't seem to find anything that addresses this. I've
> also tried to look through the archives. Can anyone offer advice?
> 
> I guess to be more to the point, I'm trying to figure out how to
> address it in the model (or if it should even be handled in the
> view).

http://www.djangoproject.com/documentation/model-api/#automatic-primary-key-fields

If you’d like to specify a custom primary key, just specify 
primary_key=True on one of your fields.


http://www.djangoproject.com/documentation/model-api/#relationships

to_field        The field on the related object that the relation is to. By 
default, Django uses the primary key of the related object.
-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___________________________________________________________________________
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to