Hi all,

I read a lot of documentation about caching queryset but seems nothing
is useful for my purpose:

I have to load a treeview and so perform virtually infinite recursion,
I want to minimize database access, here is my simplified model

class Nodes(models.Model):
   name = models.CharField(max_length=255)
   sublivello_di = models.ForeignKey('self', blank=True, null=True,
related_name='sublivelli_set')

class ObjectType1(models.Model):
  ...
  ...
  node=models.ForeignKey(Nodes)


class ObjectType2(models.Model):
  ...
  ...
  node=models.ForeignKey(Nodes)


and so on.

I would like to select all the object before recursion, for example:

allnodes=Nodes.objects.select_related('sublivello_di').all()
allobject1=ObjectType1.objects.select_related().all()

however when I do some filtering django hits the database, however all
the objects are already fetched, I need only a subset of this.

I tried pickling, caching etc.. but every time I filter django hits
the database. So the only solutions seems not to use queryset
filtering at all, any hints?

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