I think this is the intended behavior.
1. mysite/project/urls.py calls mysite.project.views.project(request,
project__name)
2. That function initializes an empty dictionary called "context". It adds a key
'random_pfentry' with a value returned by p.get_random_description() where 'p' is
the Project object.
3. In mysite/search/models.py (the Project models are in the Search app) the
function get_random_description() builds a list called pfentries from a call to
self.get_pfentries_with_usable_descriptions(), which builds its list from
get_pfentries_with_descriptions.
4. pfentries gets contstructed in the get_pfentries_with_descriptions() function.
It generates a list (from a QuerySet?) of projects, but it excludes all projects
that have a project_description == "".
5. Back to get_random_description(). If pfentries is an non-empty list,
get_random_description() returns a random list item. If pfentries is an empty list,
get_random_description() returns None.
6. In mysite/project/templates/project/project.html (the template that renders the
project page), there is a conditional {%if random_pfentry %}. If this is true (i.e.
the context['random_pfentry'] value is not None, the template renders the supplied
project_description value that was chosen in step 5. If the conditional is false
(i.e. step 5 returned None) then the template renders a message saying that "no one
has described this project yet".
Effectively, this functionality pulls the description from a random user's
description of the project (provided at least one user has described the project).
If you add a project to your profile and open up your portfoloio editor
(http://openhatch.org/+portfolio/editor/) you can add your description of the
project. This will be part of the set of desciptions that step 5 chooses at random.
I think the intent is for this page to show how different users have described the
project.
If I've misinterpreted anything and someone more knowledgeable than I wants to
weigh in I'd be glad to know where I erred.
|