shellfly / django-vote

Simple vote for django
http://django-vote.readthedocs.io
Apache License 2.0
158 stars 49 forks source link

Clear separation of the count functions/one count function for all #71

Open edegeyer opened 4 years ago

edegeyer commented 4 years ago

To me it didn't seem very obvious to me, that it only counts the UP votes if no parameter is given. The Code snippet I'm talking about is the following:

    def count(self, action=UP):
        return self.through.votes_for(self.model,
                                      self.instance, action).count()

My suggestion would be, to introduce 2 new functions: count_up(self) and count_down(self)

I would still keep the count function, but modify it in a way, that leads to it counting the up and down votes, by just calling the two other functions and returning them as a dict to the caller