Hi,

(I'm a bit of a newbie to Django so excuse any foolish mistakes)

I'm writing a basic paper review system for a conference (Paper is the
primary object, with Note and Vote objects having a foreign key to the
paper), and currently have it somewhat working.  Now my task is to
make the list of papers (currently a generic object_list view) show
whether the current user (all users are forced to login) has voted on
each paper.

My initial implementation was split across the template and the
model.  In my model:

class Paper (models.Model):
    ...
    def has_voted(paper, user):
        return paper.vote_set.filter(user__exact = user).count() != 0

then in the view:

{% for paper in object_list|dictsort:"title" %}
  {% if paper.has_voted( TODO ) %}
    <!-- todo: set different css class -->

I then discovered that you can't pass arguments to methods in
templates, so I can't ask the model if the current user has voted.

Can anyone give any hints on how I can fix this?

Thanks,
Ross


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to