From: jordan Date: Thu, 21 Jul 2011 13:06:13 +0000 (+0000) Subject: adding a setting that allows to disable the accept rate feature X-Git-Tag: live~186 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/232bdf7ce8ec8393618d75de43d4c2dcfa68cfcf?hp=c19bc0ba42a30c350e28b5edf1482ece065765a0 adding a setting that allows to disable the accept rate feature git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1127 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/settings/users.py b/forum/settings/users.py index 7bc58ec..2c2c3ac 100644 --- a/forum/settings/users.py +++ b/forum/settings/users.py @@ -38,6 +38,11 @@ help_text = _("The long usernames will be truncated.."), required=False, )) +SHOW_USER_ACCEPT_RATE = Setting('SHOW_USER_ACCEPT_RATE', True, USERS_SET, dict( +label = _("Show user accept rate"), +help_text = _("If you check this the user accept rate will be displayed on the user posts."), +required=False)) + TRUNCATE_USERNAMES_LONGER_THAN = Setting('TRUNCATE_USERNAMES_LONGER_THAN', 15, USERS_SET, dict( label = _("Truncate usernames longer than"), help_text = _("The usernames that are longer than this will be truncated and ... will be appended."))) diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index 86516e7..d0bdfc1 100644 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -82,6 +82,10 @@ def get_score_badge(user): # Usage: {% get_accept_rate node.author %} @register.simple_tag def get_accept_rate(user): + # If the Show Accept Rate feature is not activated this tag should return a blank string + if not settings.SHOW_USER_ACCEPT_RATE: + return "" + # We get the number of all user's answers. total_answers_count = Answer.objects.filter(author=user).count() diff --git a/forum_modules/exporter/exporter.py b/forum_modules/exporter/exporter.py index 8907112..87dca42 100644 --- a/forum_modules/exporter/exporter.py +++ b/forum_modules/exporter/exporter.py @@ -515,20 +515,3 @@ def export_awards(a, el, anon_data): def export_settings(s, el, anon_data): el.add('key', s.key) make_extra(el.add('value'), s.value) - - - - - - - - - - - - - - - - -