Hi,
Looking at the model, you can see that:
class KarmaScore(models.Model):
user = models.ForeignKey(User)
comment = models.ForeignKey(Comment)
[...]
So I would think that, if there's a comment of a given user, you can
know if he voted or not by doing a template tag that takes a comment
and the current user id as an argument, and does something like:
KarmaScore.objects.filter(comment=comment.id,user=user.id)
If this is zero, then the user has not voted. If it's not empty, then
the user has already voted. But I haven't tried it.
Hope it helps,
G
On 10/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I know it seems like there's been a lot of these lately, but it IS one
> of the few undocumented parts of Django. So here's my question...
> anyone have any idea how I could check if the current user has already
> voted on a comment?
>
> To clarify: I know I can get karma total, good karma total, etc., and I
> know the system is smart enough to not let a voter vote twice. But they
> can still click the link. I'm trying to figure out a way to know if
> they've voted ahead of time and then either show the total plus link or
> just the total, as appropriate.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users
-~----------~----~----~----~------~----~------~--~---