alex/django-taggit — pull request #243 by bendavis78 (2014-07-09 05:02:44+00:00)
Title: Added __str__ implementation to _TaggableManager

When coercing a TaggableManager descriptor to a string in Django 1.7, a StopIteration exception is raised since the base Manager __str__ method assumes the manager class is an a normal manager:

def __str__(self):
""" Return "app_label.model_label.manager_name". """
model = self.model
opts = model._meta
app = model._meta.app_label
manager_name = next(name for (_, name, manager)
in opts.concrete_managers + opts.abstract_managers
if manager == self)
return '%s.%s.%s' % (app, model._meta.object_name, manager_name)

This PR simply attempts to implement the same outcome as the parent class by assuming that `manager_name` is the `prefix_cache_name` passed to the manager's constructor.