I'm hoping somebody has run into this issue before, failing that,
perhaps someone can see a glaring mistake in my code.. I'm getting a
recursive loop somehow while following the example:

http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddanextracolumntothechangelistview

In the __init__.py script, i've added None to the line with:
rl = list(admin_list.items_for_result(cl, res, None)) since
items_for_results fails without 3 args..  This is running on django
1.2 btw.

<Code snip----- /project/app/templatetags/change_list_extras.py>
import admin_extras
from django import template

register = template.Library()

@register.inclusion_tag("admin/change_list_results.html")
def article_result_list(cl):
    #{#{% url publish_view obj.id %}#}
    additional_cols = (
        {'text': 'Operations', 'sortable': False, 'template': '<td><a
href="test">Publish</a></td>'},
    )
    return admin_extras.extended_result_list(cl, additional_cols)
# article_result_list = register.inclusion_tag("admin/
change_list_results.html")(article_result_list)

</Code snip----->

<Code snip------ /project/app/templates/change_list_results.html>
{% extends "admin/change_list.html" %}
{% load change_list_extras %}
{% block result_list %}{% article_result_list cl %}{% endblock %}
</Code snip----->

<Code snip----- /project/admin_extras/__init__.py
from django.contrib.admin.templatetags import admin_list
from django import template
from django.utils.safestring import mark_safe

def results(cl, col_templates):

    for res in cl.result_list:
        rl = list(admin_list.items_for_result(cl, res, None))
        for col in col_templates:
            rendered_col = col.render(template.Context({'obj': res}))
            rl.append(mark_safe(rendered_col))
        yield rl

def extended_result_list(cl, additional_cols):
    headers = list(admin_list.result_headers(cl))
    headers.extend(additional_cols)

    # Parse the templates once
    col_templates = [template.Template(col['template']) for col in
additional_cols]

    return {
        'cl': cl,
        'result_headers': headers,
        'results': list(results(cl, col_templates))
    }
</Code snip----->

And the error i'm seeing:

In template /home/webby/www/localhost/wc-web/mediaItems/templates/
admin/change_list.html, error at line 76
Caught RuntimeError while rendering: maximum recursion depth exceeded
while calling a Python object
66      </ul>
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 %}

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

Reply via email to