In my first Django app I've got the following "rough" model (not
real code, but enough to show what I mean):

   class Rateable
      some stuff common to all "Rateable" objects
   class Rating
      who = ForeignKey(User)
      what = ForeignKey(Rateable)
      values = ...
   class People(Rateable)
   class Place(Rateable)
   and several other classes

In my templates, I'd like to be able to (for example):
Given an "object_list" of rateable things, I'd like to
then get the "Rating" valules for the current user.
I'm trying to figure out a good way to do this.

I don't see any way in a template to pass an argument
to a method.  i.e. I can do 
   {{ object.get_rating_list }}
but I can't (that I can see) do
   {{ object.get_rating_list(who__id={{ user }}) }}
(or something like it

I also don't see a way to write a method in the
model to get the then current user.

So, I've started to write a templatetag to do this,
but am wondering if there's a "better" way.

I'm starting to implement my own tag like:
   {% this-rating thisone object %}
to set the variable "thisone" to the Rating of "object" for the
current user.

Is there a better way?   What am I missing?????

-- 
Glenn

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

Reply via email to