Brilliant. Thanks!
On Oct 20, 9:41 am, Javier Guerra Giraldez wrote:
> On Wed, Oct 20, 2010 at 7:59 AM, Ed wrote:
> > what is the purpose of ifchanged?
>
> since the images are sorted by film, if you just show the film for
> every image it would be repeated. with {% ifchanged %} it's only
> sh
On Wed, Oct 20, 2010 at 7:59 AM, Ed wrote:
> what is the purpose of ifchanged?
since the images are sorted by film, if you just show the film for
every image it would be repeated. with {% ifchanged %} it's only
shown before all the images for this film, so the result is like this:
film A
image
Thanks for the suggestion. Javier's was exactly what I needed. The
one question I have is why what is the purpose of ifchanged? I'm
aware of the command but I don't see the purpose of it within a loop.
On Oct 20, 5:18 am, Daniel Roseman wrote:
> On Oct 19, 9:46 pm, Ed wrote:
>
>
>
>
>
> > Th
On Oct 19, 9:46 pm, Ed wrote:
> Thanks for the answers. I thought that the view was already pulling
> the data. I didn't realize it gets pulled when called in the
> template. I was able to rewrite the view to provide the data more
> efficiently.
>
> I have another related question on the topic
On Tue, Oct 19, 2010 at 3:46 PM, Ed wrote:
> I have 3 tables: studio, film, images. If film has a foreign key to
> studio, and images has a foreign key to film. If I wanted to pull all
> of the images for a particular studio, it would be more expensive to
> pull:
what i do is: in the view, get
Thanks for the answers. I thought that the view was already pulling
the data. I didn't realize it gets pulled when called in the
template. I was able to rewrite the view to provide the data more
efficiently.
I have another related question on the topic of query expense. What
is the best practi
On Oct 19, 4:43 pm, Tom Evans wrote:
> On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman wrote:
> > The solution here is to evaluate the queryset in your view first,
> > before passing it to the template. You can do this by simply calling
> > list() on it - eg instead of defining your context as {'
On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman wrote:
> The solution here is to evaluate the queryset in your view first,
> before passing it to the template. You can do this by simply calling
> list() on it - eg instead of defining your context as {'actor_list':
> actor_list}, do {'actor_list':
On Oct 19, 3:45 pm, Ed wrote:
> I have a table for Actor that I query and populate the result in
> actor_list to pass to the template. I installed the Django Debug
> Toolbar to check the queries hitting the database and found some
> strange behavior. If I iterate through the actor_list, only one S
On Tue, Oct 19, 2010 at 9:45 AM, Ed wrote:
> Why is that? Is there a way to do this that doesn't result in two
> queries?
check:
http://docs.djangoproject.com/en/1.2/topics/db/optimization/#don-t-overuse-count-and-exists
there's a tip about loading the whole query once: use {% with
actor_list
I have a table for Actor that I query and populate the result in
actor_list to pass to the template. I installed the Django Debug
Toolbar to check the queries hitting the database and found some
strange behavior. If I iterate through the actor_list, only one SQL
query is created, as expected:
{% f
11 matches
Mail list logo