Derek Lee-Wo wrote:
>  The app I have is pretty simply as I'm just beginning so I didn't
>  bother to try and make it any smaller.  I've ZIPped the entire
>  project directory and it can be downloaded here:
>
>  http://www.roadtoboston.com/media/RoadToBoston.zip
>
>

I took a look and traced the bottleneck to lines 125 and 127 in
viewPlan.html. The problem was as Malcolm hinted -- you're
doing a foreign key lookup ({{ workout.workoutType.name }})
for each iteration of the for loop.

I changed line 55 of views.py to use select_related() instead
of all() and it solved the problem as now it no longer needs
to hit the database for every iteration.

- workouts = plan.workouts.all()
+ workouts = plan.workouts.select_related()

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