First time here? Check out the FAQ!

Check if someone have a particular badge


I created a badge moderator and I want to check if the user have this badge to allow him to delete some posts.

For example, in the file askbot/templates/question/question_controls.html

I want to put that :

{% if <check if the logged user have the badge moderator (id = 34)> %}
<a id="post-{{}}-delete" class="question-delete">
{% trans %}delete{% endtrans%}
{% endif %}
squallirvine's avatar
asked 2013-07-03 12:58:38 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


The issue is that badges are rewards not a record of permission. It will be better if you assign "moderator" status to that user via the user profile --> moderation page.

Secondly - it is not a great idea to add checks like this if user.is_X() in the templates, because this makes it more difficult to cache the template fragments. We want to share the cached template fragments with all users.

Evgeny's avatar
answered 2013-07-03 13:02:45 -0500, updated 2013-07-03 13:04:54 -0500
edit flag offensive 0 remove flag delete link


add a comment see more comments