Hi, I want to create my own templatetag that returns true if a user is member of a certain group. I did the following: Created a package „templatetags“ in my app. Wrote a module: from django import template register = template.Library() def check(user): if str(user.groups.all()[0]) == "Timesheet-Boss": return True else: return False Put this in my html: {% load checkers %} {{ check:user }} I get the following error: Invalid filter: 'check' Request Method: GET Request URL: http://localhost:8000/ Django Version: 1.2.4 Exception Type: TemplateSyntaxError Exception Value: Invalid filter: 'check' What am i doing wrong ?! Best regards
. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien
patrick.szabo@lexisnexis.at
Tel.: 00431 534521573
Fax: +43 (1) 534 52 - 146
No comments:
Post a Comment