我無法讓我的網站識別自定義模板標籤。我有以下目錄結構:如何創建自定義django過濾器標籤
- PROJECT_NAME
- PROJECT_NAME
- templatetags
- _ __init __ _.py
- getattribute.py
- 點意見
- _ __init __ _.py
- 的index.html
- 意見
- settings.py
- main.py
- manage.py
- urls.py
- templatetags
- nbproject的
- PROJECT_NAME
然後,我已經加入這個在INSTALLED_APPS:
{% load getattribute %}
{% for header in headers %}
<td>{{ obj|getattribute:header }}</td>
{% endfor %}
這是我得到的錯誤是:
INSTALLED_APPS = (
# 'django.contrib.auth',
'django.contrib.contenttypes',
# 'django.contrib.sessions',
'django.contrib.sites',
'project_name'
)
我那麼模板像這裏面引用此如下:
Could not import controllers.EventController. Error was: No module named project_name
任何幫助,將不勝感激這個:
TIA
安德魯
UPDATE:
該網站工作,但我不能得到的模板標籤的工作。如果我從installed_apps中刪除了project_name,我會收到以下錯誤:
Exception Value: 'getattribute' is not a valid tag library: Could not load template library from django.templatetags.getattribute, No module named getattribute
感謝您的輸入我已經更新了我的問題 – 2010-01-17 17:59:14