Just a couple brief thoughts.

First, there is no need to have the username in the URL if this page
is visible only to the logged-in user. Instead, use the request.user
object inside your view (and, if necessary, the template).

Second, to retrieve various info about the user there is no need for
custom tags. Instead, use the ORM to retrieve the related objects
directly.

For example, imagine you have the model Comment which has the User as
its ForeignKey; you can then use request.user.comment_set to retrieve
all the comments made by that user. Or, as I prefer, use related_name
in the Comment model definition, so you can do e.g.
request.user.comments. For friends you would probably need a
ManyToManyKey field, but the rest of the logic is the same.

Berislav

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to