Re: Traversing Deep Model Objects in template...

2007-08-04 Thread Amirouche
On Aug 1, 11:04 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >From the documentation: > > "A ValuesQuerySet is useful when you know you're only going to need > values from a small number of the available fields and you won't need > the functionality of a model instance object. It's more ef

Re: Traversing Deep Model Objects in template...

2007-08-01 Thread [EMAIL PROTECTED]
> // I prefer use names instead of ids in urls because it's more human > friendly Of course, this is just a functional example. > I don't think that the use of the values method is that widespread... > if you use I would suggest you to think it twice. http://www.djangoproject.com/documentation/

Re: Traversing Deep Model Objects in template...

2007-07-31 Thread Amirouche
> authors = book.authors.all().values('first_name','last_name',) I don't think that the use of the values method is that widespread... if you use I would suggest you to think it twice. --~--~-~--~~~---~--~~ You received this message because you a

Re: Traversing Deep Model Objects in template...

2007-07-31 Thread Amirouche
On Jul 31, 8:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > def index(request): > books = Book.objects.all().select_related()[:3] what is doing the 3 ? {% for book in books %} {{ book.title }} // I prefer use names instead of ids in urls because it's more human friend

Re: Traversing Deep Model Objects in template...

2007-07-31 Thread [EMAIL PROTECTED]
Is this the *best* way to accomplish this? It seems like the author DB query per book isn't very efficient (where it might sense to do a JOIN) Also, if I was doing any more "levels" things would get very complicated and bloated. view.py: ... def index(request): data = Book.objects.all().v

Traversing Deep Model Objects in template...

2007-07-30 Thread [EMAIL PROTECTED]
I'm using the Books, Publishers, Authors example from the documentation (Django Book) and I'm trying to figure out how to get related data in a list. For example, I want to print a list of books and a list of authors for each book in my template. What do I have to do to make the code below functio