Hi Paul,

I don't think it would entail two db lookups, but like I said I haven't
tested it. SA will be instantiating a django Model, but it will be filling
in it's data from the database, so there should be no lookup required by
django.

It does overwrite the field as far as I know, but that shouldn't matter in
because all you get from a field is that field's value from the database
anyway. The django ORM is still usable... So you still get the ability to do
reverse related lookups and such, even from objects in a list returned by
SA: i.e. if you have the following

class Alarm(models.Model):
    ....
    ran_obj = models.ForeignKey(RANObject, related_name='alarms')
    .....

and you get a list of RANObjects from some complicated lookup that you use
SA for, then you should still be able to do:

    ran_ob.alarms.all()

This is one case where I could envisage using SA and django ORM side by
side.
That way you won't have to mess with any of your views/admin/django core
functionality, as the underlying objects are still just django models.

What do you think?

Ben

On 06/10/2007, Paul Davis <[EMAIL PROTECTED]> wrote:
>
>
> SmileyChris,
>
> At the moment, I'm using the class_prepared signal to gather all
> loaded models. Theoretically I could use this to attach an SA
> attribute.
>
> Are there use cases out there where you'd want to use *both* the
> Django and SA ORM's side by side? To me it makes more sense to import
> one or the other depending on what you plan on doing. For instance all
> of my code will use just the SA models, but the admin will still use
> the Django models.
>
> Paul
>
> On 10/5/07, SmileyChris <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On Oct 6, 5:24 am, "Paul Davis" <[EMAIL PROTECTED]> wrote:
> > > Ben,
> > >
> > > I contemplated something like this, but I assumed that field
> > > properties would clash. For instance, after the call to mapper(...)
> > > you would no longer have access to Django ORM fields with the
> > > Model.field syntax (as they would be replaced by SA's).
> >
> > Could you use the post_init signal to attach a LazySAModel object as
> > an SA (or something) property of all newly created Django models?
> >
> >
> > >
> >
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+6281317958862

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to