﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26267	"Template filter ""slice"" raises TypeError on bound RadioSelect"	Jon Dufresne	nobody	"I have a template with the following snippet:

{{{
{% for choice in form.choices|slice:'1:' %}
    <li>{{ choice }}</li>
{% endfor %}
}}}

Where choices is a {{{ChoiceField}}} with a {{{RadioSelect}}} widget. This stopped working in 1.8.

Looking through the code history, this looks like it was introduce in commit [https://github.com/django/django/commit/5e06fa14 5e06fa14] during work on ticket #22745.

The change to {{{BoundField.__getitem__()}}}:

{{{
      def __getitem__(self, idx):
+        # Prevent unnecessary reevaluation when accessing BoundField's attrs
+        # from templates.
+        if not isinstance(idx, six.integer_types):
+            raise TypeError
         return list(self.__iter__())[idx]
}}}

It no longer accepts a `slice` and will instead raise a {{{TypeError}}}."	Bug	closed	Template system	1.8	Release blocker	fixed			Ready for checkin	1	0	0	0	0	0
