From 7b2bb6ea11eade0e4eeffabb444cd053d728bfab Mon Sep 17 00:00:00 2001 From: ArturBaybulatov Date: Mon, 27 Jun 2016 20:01:07 +0300 Subject: [PATCH] #ARC-12 --- common/templatetags/common_tags.py | 17 +- projects/templates/customer_project_edit.html | 10 +- projects/views.py | 152 +++++------------- 3 files changed, 61 insertions(+), 118 deletions(-) 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 @@