Ticket 15849, make ifchanged node thread safe.

Previously, the ifchanged node stored state on `self._last_seen`, theirby giving undesired results when the node is reused by another thread at the same time (e.g. globally caching a Template object).

This patch addresses that, by using `context['forloop']` in for loops and `context.render_context` as fallback. Concurrency is emulated in the tests thanks to generators.

Ticket: https://code.djangoproject.com/ticket/15849