List Info

Thread: (Newbie) TemplateSyntaxError in admin panel




(Newbie) TemplateSyntaxError in admin panel
user name
2007-12-20 02:11:31
Hello,

I'm going through the Django tutorial for Django 0.9.6 on
Windows
Vista. Everything is going smoothly, and I'm following the
tutorial to
a T; except when I'm in my admin site (step 2 of the
tutorial),
clicking any of the links (Groups/Users/Sites/Polls), I get
a
TemplateSyntaxError, appended below. Any ideas on how to fix
this? The
only thing I did outside of the tutorial instructions was to
follow
the fix described here because of an apparent flaw with
0.96.:
http://forums.devshed.com/showpost.php?p=1856484
&postcount=2

Thanks!

Rex

===============================
TemplateSyntaxError at /admin/polls/poll/
Invalid arguments to 'cycle': ['cycle', "'row1'",
"'row2'"]
Request Method: 	GET
Request URL: 	http://127.0.
0.1:8000/admin/polls/poll/
Exception Type: 	TemplateSyntaxError
Exception Value: 	Invalid arguments to 'cycle': ['cycle',
"'row1'",
"'row2'"]
Exception Location:
	C:Python25libsite-packagesdjangotemplate
defaulttags.py in cycle, line 434
Template error

In template
C:Python25libsite-packagesdjangocontribadmin
templatesadmin/change_list_results.html, error at line 13
Invalid arguments to 'cycle': ['cycle', "'row1'",
"'row2'"]
3 	<thead>
4 	<tr>
5 	{% for header in result_headers %}<th{{
header.class_attrib }}>
6 	{% if header.sortable %}<a href="{{ header.url
}}">{% endif %}
7 	{{ header.text|capfirst }}
8 	{% if header.sortable %}</a>{% endif
%}</th>{% endfor %}
9 	</tr>
10 	</thead>
11 	<tbody>
12 	{% for result in results %}
13 	<tr class="{% cycle 'row1' 'row2' %}">{%
for item in result %}
{}{% endfor %}</tr>
14 	{% endfor %}
15 	</tbody>
16 	</table>
17 	{% endif %}
18
===============================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: (Newbie) TemplateSyntaxError in admin panel
user name
2007-12-23 12:50:05
Hi,

Is there any solution to the below described problem? I
still haven't
been able to get it to work.

Best,
Rex

On Dec 20, 3:11 am, Rex Eastbourne <rex.eastbou...gmail.com> wrote:
> Hello,
>
> I'm going through the Django tutorial for Django 0.9.6
on Windows
> Vista. Everything is going smoothly, and I'm following
the tutorial to
> a T; except when I'm in my admin site (step 2 of the
tutorial),
> clicking any of the links (Groups/Users/Sites/Polls), I
get a
> TemplateSyntaxError, appended below. Any ideas on how
to fix this? The
> only thing I did outside of the tutorial instructions
was to follow
> the fix described here because of an apparent flaw with
0.96.:http://forums.devshed.com/showpost.php?p=1856484
&postcount=2
>
> Thanks!
>
> Rex
>
> ===============================
> TemplateSyntaxError at /admin/polls/poll/
> Invalid arguments to 'cycle': ['cycle',
"'row1'", "'row2'"]
> Request Method:         GET
> Request URL:    http://127.0.
0.1:8000/admin/polls/poll/
> Exception Type:         TemplateSyntaxError
> Exception Value:        Invalid arguments to 'cycle':
['cycle', "'row1'",
> "'row2'"]
> Exception Location:    
C:Python25libsite-packagesdjangotemplate
> defaulttags.py in cycle, line 434
> Template error
>
> In template
C:Python25libsite-packagesdjangocontribadmin
> templatesadmin/change_list_results.html, error at
line 13
> Invalid arguments to 'cycle': ['cycle',
"'row1'", "'row2'"]
> 3       <thead>
> 4       <tr>
> 5       {% for header in result_headers %}<th{{
header.class_attrib }}>
> 6       {% if header.sortable %}<a href="{{
header.url }}">{% endif %}
> 7       {{ header.text|capfirst }}
> 8       {% if header.sortable %}</a>{% endif
%}</th>{% endfor %}
> 9       </tr>
> 10      </thead>
> 11      <tbody>
> 12      {% for result in results %}
> 13      <tr class="{% cycle 'row1' 'row2'
%}">{% for item in result %}
> {}{% endfor %}</tr>
> 14      {% endfor %}
> 15      </tbody>
> 16      </table>
> 17      {% endif %}
> 18
> ===============================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: (Newbie) TemplateSyntaxError in admin panel
user name
2007-12-23 14:18:19
On Dec 23, 2007 1:50 PM, Rex Eastbourne < rex.eastbournegmail.com">rex.eastbournegmail.com> wrote:

Hi,

Is there any solution to the below described problem? I still haven't
been able to get it to work.

Best,
Rex

Somehow it seems you have gotten recent templates from SVN mixed in with code from 0.96. ; Details below.


On Dec 20, 3:11 am, Rex Eastbourne < rex.eastbou...gmail.com">rex.eastbou...gmail.com> wrote:
>; Hello,
>;
> I'm going through the Django tutorial for Django 0.9.6 on Windows
&gt; Vista. Everything is going smoothly, and I'm following the tutorial to
> a T; except when I'm in my admin site (step 2 of the tutorial),
> clicking any of the links (Groups/Users/Sites/Polls), I get a
> TemplateSyntaxError, appended below. Any ideas on how to fix this? The
> only thing I did outside of the tutorial instructions was to follow
>; the fix described here because of an apparent flaw with 0.96.:http://forums.devshed.com/showpost.php?p=1856484&postcount=2
>;

I';d guess following these instructions is how you somehow got current SVN templates mixed in with 0.96 code.
&nbsp;

> Thanks!
&gt;
> Rex
>
&gt; ===============================
> TemplateSyntaxError at /admin/polls/poll/
&gt; Invalid arguments to 'cycle': ['cycle', "';row1'&quot;, "';row2'&quot;]
&gt; Request Method:         GET
> Request URL:    http://127.0.0.1:8000/admin/polls/poll/
&gt; Exception Type:         TemplateSyntaxError
> Exception Value:        Invalid arguments to 'cycle': ['cycle', "';row1'&quot;,
> "';row2'&quot;]
> Exception Location:     C:Python25libsite-packagesdjangotemplate
> defaulttags.py in cycle, line 434
> Template error
>

This error appears to be coming from 0.96 code, it matches this line:

http://code.djangoproject.com/browser/django/tags/releases/0.96/django/template/defaulttags.py#L434
 
> In template C:Python25libsite-packagesdjangocontribadmin
> templatesadmin/change_list_results.html, error at line 13
> Invalid arguments to 'cycle': ['cycle', "';row1'&quot;, "';row2'&quot;]
&gt; 3       <thead&gt;
> 4       <tr>
> 5       {% for header in result_headers %}<th{{ header.class_attrib }}>
>; 6       {% if header.sortable %}<a href=";{{ header.url }}"&gt;{% endif %}
> 7       {{ header.text|capfirst }}
> 8       {% if header.sortable %}</a&gt;{% endif %}</th&gt;{% endfor %}
> 9       </tr>;
> 10      </thead>
> 11      <tbody>
> 12      {% for result in results %}
> 13      <tr class=&quot;{% cycle 'row1&#39; 'row2&#39; %}"&gt;{% for item in result %}

But this is not what was in the 0.96 version of this template file. ; Rather it was:

<tr&nbsp;class="{% cycle row1,row2 %}">{% for item in result %}{}{% endfor %} </tr>;

(see http://code.djangoproject.com/browser/django/tags/releases/0.96/django/contrib/admin/templates/admin/change_list_results.html#L13 )

What you have here seems to be the current SVN contents of this template:

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin/change_list_results.html#L13

From the revision history you can tell that changeset 6153 went in on 9/13/07 and substantially changed the way the cycle tag was processed.
 
[snip the rest]

You need to get either all the proper 0.96 versions of the templates, or use the code that goes with your post-0.96 version of the template files.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )