I'm learning about ORM, but it's not easy to understand the whole
picture.
I'm trying to create a "function" or a "filter" linked to my models.py
or to PHPmyAdmin to give me a signal when something is changing.
I'm making reseachs on signal on django, perhaps a solution to
explore.

If you have other informations about ORM or a way to bind the whole
thing together.

Thanks for your response.

Seth

On Nov 24, 6:04 pm, "Travis Veazey" <[EMAIL PROTECTED]>
wrote:
> Seth,
> The reason that you don't see the values in u3 change when you change the
> database is that the models don't read from the database every time you want
> to get a value - that would be silly and would cause Django to be among the
> worst-performing frameworks in existence. Database reads take time, and to
> avoid that overhead any good ORM will get the values once and then hold them
> in memory.
>
> If you were to modify your database values and then retrieve a new object
> (via the filter() method or whatever), you will see your modifications show
> up.
>
> I'm afraid I'm too new to Django to tell you if there's a method to force a
> model to refresh its data from the database, but I'm an old hand at ORMs in
> general and I know from working with a very poorly-implemented one (this one
> would make a separate database call for each field value you wanted to
> retrieve; displaying an employee's first, middle, and last names, for
> example, would require 3 database queries) that reducing your round-trips to
> the database significantly reduces the amount of time required to process
> your script (in the example I mentioned, modifying the ORM to make only a
> single call to get all the values resulted in reducing page load time by
> almost a full third!).
>
> Hope this gives you some insight.
>
> -Travis
>
> On Mon, Nov 24, 2008 at 6:33 AM, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> > Seth Kaïne wrote:
> > > I want to have some more, please.
> > > When I do that:
>
> > >>>> python manage.py shell
>
> > >>>> from httpbackend.models import Unit
> > >>>> Unit.objects.all()
>
> > > [<Unit: Toto (g.com)>, <Unit: Pingo (s.com)>, <Unit: Titi (p.com)>,
> > > <Unit: Jason (f.com)>]
>
> > >>>> u3 = Unit.objects.filter(id=3)[0]
> > >>>> u3.status
>
> > > <UnitStatus: OFFLINE>
> > > ------- I change the status for an ONLINE statement with phpmyadmin in
> > > my Table Unit to test if django orm takes modifications to the objet
> > > from the DB ------
>
> > >>>> u3.status
>
> > > <UnitStatus: OFFLINE>
> > > ------- no, nothing -------
>
> > > I want to know why?
>
> > > And I want to solve this, please!
> > >  thank you, come again!
>
> > At the very least you would need to read the database again, as there is
> > nothing that would "magically" make the already-in-memory u3 object
> > update itself when the database content changes.
>
> > regards
> >  Steve
--~--~---------~--~----~------------~-------~--~----~
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