Commits

Anonymous committed db460bb

Fixes to anonymous rating system.

  • Participants
  • Parent commits 36af837

Comments (0)

Files changed (3)

File ratings/cookies.py

     """
     mapping = {
         'model': str(instance._meta),
-        'content_type_id': str(content_type.pk),
+        'object_id': instance.pk,
         'key': key,
     }
     return settings.COOKIE_NAME_PATTERN % mapping

File ratings/forms/__init__.py

             # votes are handled by cookies
             if not ip_address:
                 raise exceptions.DataError('Invalid ip address')
-            cookie_name = cookies.get_name(self.target_object, key)
+            cookie_name = cookies.get_name(self.target_object, self.key)
             cookie_value = request.COOKIES.get(cookie_name)
             if cookie_value:
                 # the user maybe voted this object (it has a cookie)

File ratings/handlers.py

 
         This method is called only if the user does not provide a rating key.
         """
-        return default_key
+        return self.default_key
         
     def allow_key(self, request, instance, key):
         """
         Called by *success_response* when the vote is by an nonymous user.
         Set the cookie to the response.
         """
-        cookie_name = cookies.get_name(vote.content_object, vote.key)
+        cookie_name = str(cookies.get_name(vote.content_object, vote.key))
         if deleted:
             response.delete_cookie(cookie_name)
         else: