Привет, пытаюсь освоить Django. Создал проект по книжке, но не могу победить ошибку:
TemplateSyntaxError at /admin/books/book/
Caught AttributeError while rendering: 'str' object has no attribute 'year'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/books/book/
Django Version: 1.2.5
Exception Type: TemplateSyntaxError
Exception Value:
Caught AttributeError while rendering: 'str' object has no attribute 'year'
Exception Location: C:\Python27\lib\site-packages\django-1.2.5-py2.7.egg\django\contrib\admin\templatetags\admin_list.py in date_hierarchy, line 282
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path: ['D:\\WORK\\DJANGO\\mysite', 'C:\\Python27\\lib\\site-packages\\genshi-0.6-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\xlrd-0.7.1-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\xlwt-0.7.2-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\xlutils-1.4.1-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\errorhandler-1.1.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pip-0.8.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pyside-1.0.0qt472-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\rdflib-3.0.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pycim-14.15.2-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\cim-14.12a1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pylon-0.4.4-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\simplejson-2.1.3-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\sparqlwrapper-1.4.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\ipython-0.10.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pysnmp-4.1.15a-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pycrypto-2.3-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\pyasn1-0.0.13a-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django-1.2.5-py2.7.egg', 'C:\\Program Files\\JetBrains\\PyCharm 1.1.1\\helpers', 'D:\\WORK\\DJANGO\\mysite', 'D:\\WORK\\DJANGO', 'C:\\WINDOWS\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
Server time: Чтв, 17 Мар 2011 14:17:10 +0300
Template error
In template c:\python27\lib\site-packages\django-1.2.5-py2.7.egg\django\contrib\admin\templates\admin\change_list.html, error at line 77
Caught AttributeError while rendering: 'str' object has no attribute 'year'
67 {% endif %}
68 {% endblock %}
69 {% if cl.formset.errors %}
70 <p class="errornote">
71 {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
72 </p>
73 {{ cl.formset.non_form_errors }}
74 {% endif %}
75 <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
76 {% block search %}{% search_form cl %}{% endblock %}
77 {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
78
79 {% block filters %}
80 {% if cl.has_filters %}
81 <div id="changelist-filter">
82 <h2>{% trans 'Filter' %}</h2>
83 {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
84 </div>
85 {% endif %}
86 {% endblock %}