fixed #54: Default reputation must be 0
This commit is contained in:
parent
2338b07a75
commit
dae34b0dd8
3 changed files with 11 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
from datetime import datetime
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from markdown import Markdown
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User, Group
|
||||
|
@ -10,8 +10,6 @@ from django.utils.html import escape, strip_tags
|
|||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.hashcompat import sha_constructor
|
||||
#from django.contrib.markup.templatetags.markup import markdown
|
||||
from markdown import Markdown
|
||||
|
||||
from forum.markups import mypostmarkup
|
||||
from forum.fields import AutoOneToOneField, ExtendedImageField, JSONField
|
||||
|
|
|
@ -55,16 +55,16 @@
|
|||
{% endif %}
|
||||
{% if "REPUTATION_SUPPORT"|forum_setting %}
|
||||
{% ifnotequal request.user post.user.username %}
|
||||
<dd><a href="{% url reputation post.user %}">{% trans "Reputation" %}</a> : <a href="{% url reputation post.user %}?action=plus&topic_id={{ post.topic.id }}"><img src="{{ MEDIA_URL }}forum/img/reputation/warn_add.gif" alt="+" border="0"></a> <strong>{{ post.user.forum_profile.reply_total }} </strong><a href="{% url reputation post.user %}?action=minus&topic_id={{ post.topic.id }}"><img src="{{ MEDIA_URL }}forum/img/reputation/warn_minus.gif" alt="-" border="0"></a></dd>
|
||||
<dd><a href="{% url reputation post.user %}">{% trans "Reputation" %}</a> : <a href="{% url reputation post.user %}?action=plus&topic_id={{ post.topic.id }}"><img src="{{ MEDIA_URL }}forum/img/reputation/warn_add.gif" alt="+" border="0"></a> <strong>{{ post.user.forum_profile.reply_total }} </strong><a href="{% url reputation post.user %}?action=minus&topic_id={{ post.topic.id }}"><img src="{{ MEDIA_URL }}forum/img/reputation/warn_minus.gif" alt="-" border="0"></a></dd>
|
||||
{% endifnotequal %}
|
||||
{% endif %}
|
||||
<dd class="usercontacts"><a href="{% url forum_profile post.user %}">{% trans "Profile" %}</a>
|
||||
{% ifequal post.user.forum_profile.privacy_permission 0 %}
|
||||
<a href="mailto:{{ post.user.email }}">{% trans "E-mail" %}</a>
|
||||
{% else %}
|
||||
{% ifequal post.user.forum_profile.privacy_permission 1 %}
|
||||
<a href="mailto:{{ post.user.email }}">{% trans "E-mail" %}</a>
|
||||
{% else %}
|
||||
{% ifequal post.user.forum_profile.privacy_permission 1 %}
|
||||
<a href="{% url misc %}?mail_to={{ post.user }}">{% trans "Send e-mail" %}</a>
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
{% if "PM_SUPPORT"|forum_setting %}
|
||||
{% if user.is_authenticated %}
|
||||
|
|
|
@ -291,13 +291,12 @@ def show_topic(request, topic_id, full=True):
|
|||
if forum_settings.REPUTATION_SUPPORT:
|
||||
replies_list = Reputation.objects.filter(to_user__pk__in=users).values('to_user_id').annotate(sign=Sum('sign')) #values_list buggy?
|
||||
|
||||
if replies_list:
|
||||
replies = {}
|
||||
for r in replies_list:
|
||||
replies[r['to_user_id']] = r['sign']
|
||||
replies = {}
|
||||
for r in replies_list:
|
||||
replies[r['to_user_id']] = r['sign']
|
||||
|
||||
for post in posts:
|
||||
post.user.forum_profile.reply_total = replies.get(post.user.id, 0)
|
||||
for post in posts:
|
||||
post.user.forum_profile.reply_total = replies.get(post.user.id, 0)
|
||||
|
||||
initial = {}
|
||||
if request.user.is_authenticated():
|
||||
|
|
Reference in a new issue