Some sample code excerpts, before my question: (this code is incomplete, but should give the idea of where I'm headed)
class Rateable(meta.Model): value = meta.IntegerField() def current_rating(self): try: r = self.get_ratee_list() except: return "None" n = sum = 0 for rr in r: n = n + 1 sum = sum + rr.value if n == 0: return "None" return sum/n class Rating(meta.Model): value = meta.IntegerField() ratee = meta.ForeignKey(Rateable) rater = meta.ForeignKey(User) class Place(Rateable): class Thing(Rateable): Now, I've easily writen templates that show Places or Things and that show the ratings for each using {{ object.current_rating }} (as appropriate, of course). But, I'm trying to figure out how to write a template that would (a) show the rating for this object for user X or (b) show the rating for this object for the current user. I can think of a couple of ways to approach this problem, but I don't know which path is "better"... I could write a custom template tag that takes "user" as an argument; or I could try to see how else to pass an argument or a context variable back to a class' method. Or, perhaps I'm way off base and neither of these paths is right and there's a much better way to attack this. I'd appreciate some guidance on how to approach this problem... Thanks -- 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 -~----------~----~----~----~------~----~------~--~---