diff options
author | Mike Chen <chagel@gmail.com> | 2009-07-05 10:23:06 +0800 |
---|---|---|
committer | Mike Chen <chagel@gmail.com> | 2009-07-05 10:23:06 +0800 |
commit | 2acb62174ab2cac9c7a88faafcb5f0a22a54db6f (patch) | |
tree | 93e9d22d6fb8a6c882e3915a8511a3ac542a1e67 /forum/templatetags/extra_filters.py | |
download | askbot-2acb62174ab2cac9c7a88faafcb5f0a22a54db6f.tar.gz askbot-2acb62174ab2cac9c7a88faafcb5f0a22a54db6f.tar.bz2 askbot-2acb62174ab2cac9c7a88faafcb5f0a22a54db6f.zip |
initiliaze git rep
Diffstat (limited to 'forum/templatetags/extra_filters.py')
-rw-r--r-- | forum/templatetags/extra_filters.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/forum/templatetags/extra_filters.py b/forum/templatetags/extra_filters.py new file mode 100644 index 00000000..744fa762 --- /dev/null +++ b/forum/templatetags/extra_filters.py @@ -0,0 +1,83 @@ +from django import template
+from forum import auth
+
+register = template.Library()
+
+@register.filter
+def can_vote_up(user):
+ return auth.can_vote_up(user)
+
+@register.filter
+def can_flag_offensive(user):
+ return auth.can_flag_offensive(user)
+
+@register.filter
+def can_add_comments(user):
+ return auth.can_add_comments(user)
+
+@register.filter
+def can_vote_down(user):
+ return auth.can_vote_down(user)
+
+@register.filter
+def can_retag_questions(user):
+ return auth.can_retag_questions(user)
+
+@register.filter
+def can_edit_post(user, post):
+ return auth.can_edit_post(user, post)
+
+@register.filter
+def can_delete_comment(user, comment):
+ return auth.can_delete_comment(user, comment)
+
+@register.filter
+def can_view_offensive_flags(user):
+ return auth.can_view_offensive_flags(user)
+
+@register.filter
+def can_close_question(user, question):
+ return auth.can_close_question(user, question)
+
+@register.filter
+def can_lock_posts(user):
+ return auth.can_lock_posts(user)
+
+@register.filter
+def can_accept_answer(user, question, answer):
+ return auth.can_accept_answer(user, question, answer)
+
+@register.filter
+def can_reopen_question(user, question):
+ return auth.can_reopen_question(user, question)
+
+@register.filter
+def can_delete_post(user, post):
+ return auth.can_delete_post(user, post)
+
+@register.filter
+def can_view_user_edit(request_user, target_user):
+ return auth.can_view_user_edit(request_user, target_user)
+
+@register.filter
+def can_view_user_votes(request_user, target_user):
+ return auth.can_view_user_votes(request_user, target_user)
+
+@register.filter
+def can_view_user_preferences(request_user, target_user):
+ return auth.can_view_user_preferences(request_user, target_user)
+
+@register.filter
+def is_user_self(request_user, target_user):
+ return auth.is_user_self(request_user, target_user)
+
+@register.filter
+def cnprog_intword(number):
+ try:
+ if 1000 <= number < 10000:
+ string = str(number)[0:1]
+ return "<span class=""thousand"">%sk</span>" % string
+ else:
+ return number
+ except:
+ return number
\ No newline at end of file |