diff --git a/common/templatetags/common_tags.py b/common/templatetags/common_tags.py index 37b43ae..1f76ddd 100644 --- a/common/templatetags/common_tags.py +++ b/common/templatetags/common_tags.py @@ -1,20 +1,19 @@ from django import template from pprint import pprint, pformat +import os register = template.Library() @register.inclusion_tag('templatetags/inspect.html', takes_context=True) def inspect(context, obj): - return { - 'obj': pformat(obj.__dict__), - } + return {'obj': pformat(obj.__dict__)} + @register.inclusion_tag('templatetags/inspect.html', takes_context=True) def inspect2(context, obj): - return { - 'obj': pformat(dir(obj)), - } + return {'obj': pformat(dir(obj))} + @register.simple_tag def interact(**kwargs): @@ -35,4 +34,10 @@ def to_str(val): def multiply(string, times): return string * times + +@register.filter('basename') +def basename(val): + return os.path.basename(val) + + # import code; code.interact(local=dict(globals(), **locals())) diff --git a/projects/templates/customer_project_edit.html b/projects/templates/customer_project_edit.html index 11e06b9..7c48e46 100644 --- a/projects/templates/customer_project_edit.html +++ b/projects/templates/customer_project_edit.html @@ -42,10 +42,12 @@