List Info

Thread: Django newb question about status of OneToOne relationships in ORM




Django newb question about status of OneToOne relationships in ORM
user name
2007-12-26 23:11:45
Hi, I read here:
http://www.djangoproject.com/documentation/model-api/

"The semantics of one-to-one relationships will be
changing soon, so
we don't recommend you use them. If that doesn't scare you
away, keep
reading."

I've never used Django before, and I'm trying to decide
between using
it and Rails for my next project. The thought that a serious
piece of
the API might change soon is almost enough to scare me away
from
Django. I was wondering if anyone could point me to a
resource that
describes what the issue is with the OneToOne relationship
that might
cause it to change, and in what way.
Please let me know. Thanks.

Jake

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Django newb question about status of OneToOne relationships in ORM
country flaguser name
Australia
2007-12-26 23:17:12

On Thu, 2007-12-27 at 00:11 -0500, Jake B wrote:
> Hi, I read here:
> http://www.djangoproject.com/documentation/model-api/
> 
> "The semantics of one-to-one relationships will be
changing soon, so
> we don't recommend you use them. If that doesn't scare
you away, keep
> reading."
> 
> I've never used Django before, and I'm trying to decide
between using
> it and Rails for my next project. The thought that a
serious piece of
> the API might change soon is almost enough to scare me
away from
> Django.

Keep things in perspective. You can code almost anything
without using
the OneToOneField field. ForeignKey(unique=True) is pretty
much
functionally equivalent. If things come down to this as the
deciding
factor, then you really have no problems at all.

>  I was wondering if anyone could point me to a resource
that
> describes what the issue is with the OneToOne
relationship that might
> cause it to change, and in what way.

At the moment, OneToOneField isn't coded entirely
consistently with the
other relation fields. The plan is to reimplement and make
the following
changes:

        - it won't have to be a primary key (currently,
including
        OneToOneField forces that field to be the pk field,
which means
        you can only have one per model).
        
        - it will support reverse relations (currently, it
doesn't).
        
        - whereas the reverse of a ForeignKey(unique=True)
relation is a
        queryset containing a single element, the reverse of
a
        OneToOneField will be the object itself. So it will
be a
        fraction easier to use more directly when you know
things are
        related one-to-one like this.
        
Regards,
Malcolm

-- 
Despite the cost of living, have you noticed how popular it
remains? 
http://www.pointy-s
tick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )