From c66fb1445796f8bf5508773d4487e428aabcdaf4 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Fri, 3 Dec 2010 23:46:14 +0100 Subject: moved settings --- coip/extensions/templatetags/permdisplay.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 coip/extensions/templatetags/permdisplay.py (limited to 'coip/extensions') diff --git a/coip/extensions/templatetags/permdisplay.py b/coip/extensions/templatetags/permdisplay.py new file mode 100644 index 0000000..a2b347d --- /dev/null +++ b/coip/extensions/templatetags/permdisplay.py @@ -0,0 +1,21 @@ +from django import template + +register = template.Library() + +MOMENT = 120 # duration in seconds within which the time difference + # will be rendered as 'a moment ago' + +perms = {'r':'read', + 'w':'write', + 'd':'delete', + 'i':'insert', + 'l':'list'} + +def permdisplay(perm): + if perm: + return "can %s" % (' '.join([perms[p] for p in perm])) + else: + return "can do nothing" + +permdisplay.is_safe = True +register.filter(permdisplay) \ No newline at end of file -- cgit v1.1