Author: jtauber
Date: Thu Oct 2 20:46:08 2008
New Revision: 997
Modified:
trunk/apps/core_apps/friends_app/views.py
Log:
added view for loosely-coupled display of friends' objects
Modified: trunk/apps/core_apps/friends_app/views.py
==============================================================================
--- trunk/apps/core_apps/friends_app/views.py (original)
+++ trunk/apps/core_apps/friends_app/views.py Thu Oct 2 20:46:08 2008
@@ -91,3 +91,22 @@
"bbauth_token": request.session.get('bbauth_token'),
"authsub_token": request.session.get('authsub_token'),
}, context_instance=RequestContext(request))
+
+
[EMAIL PROTECTED]
+def friends_objects(request, template_name, friends_objects_function):
+ """
+ Display friends' objects.
+
+ This view takes a template name and a function. The function should
+ take an iterator over users and return an iterator over objects
+ belonging to those users. This iterator over objects is then passed
+ to the template of the given name as ``object_list``.
+ """
+
+ friends = friend_set_for(request.user)
+ object_list = friends_objects_function(friends)
+
+ return render_to_response(template_name, {
+ "object_list": object_list,
+ }, context_instance=RequestContext(request))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---