Get karma points of contributors

asked 2013-09-25 14:12:56 -0600

SocialQA gravatar image

At the moment contributors are listed by using the following

 u_id = list(Post.objects.filter(post_type__in=('question', 'answer'), thread__in=thread_list).values_list('author', flat=True))

and then the list get order based on avatar

contributors = User.objects.filter(id__in=u_id).order_by('avatar_type', '?')[:avatar_limit]

Instead of that I want to convert this as a leader board like based on the karma points: So I added the following.

contributors = User.objects.filter(id_in = u_id).order_by('reputation')

I ended up getting following error:

[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71] mod_wsgi (pid=12141): Exception occurred processing WSGI script '/myaskbot/django.wsgi'.
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71] Traceback (most recent call last):
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/core/handlers/wsgi.py", line 241, in __call__
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     response = self.get_response(request)
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py", line 179, in get_response
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/core/handlers/base.py", line 228, in handle_uncaught_exception
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     return callback(request, **param_dict)
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/utils/decorators.py", line 91, in _wrapped_view
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     response = view_func(request, *args, **kwargs)
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg/django/views/defaults.py", line 33, in server_error
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     return http.HttpResponseServerError(t.render(Context({})))
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Coffin-0.3.7-py2.7.egg/coffin/template/__init__.py", line 55, in render
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     return super(Template, self).render(**context)
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/local/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg/jinja2/environment.py", line 894, in render
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]     return self.environment.handle_exception(exc_info, True)
[Wed Sep 25 14:02:15 2013] [error] [client 128.101.35.71]   File "/myaskbot/askbot/templates/500 ...
(more)
edit retag flag offensive close merge delete