fix AttributeError: 'TaggableRel' object has no attribute 'to'

https://github.com/alex/django-taggit/pull/240 with better backwards-compatibility and a test.