sunlightlabs/django-secretballot — pull request #18 by Afnarel (2014-05-18 12:43:30+00:00)
Title: Solving issue #13 (related fields access)

This pull request solves the problem raised in issue #13.

The problem was that accessing an object using

~~~python
post = get_object_or_404(Post, pk=post_id)
~~~

or

~~~python
post_moderator.post
~~~

didn't use the VotableManager but the "plain" manager django.db.models.Manager as explained [here](https://docs.djangoproject.com/en/dev/topics/db/managers/#using-managers-for-related-object-access).

Adding

~~~python
use_for_related_fields = True
~~~

to the VotableManager class solves this problem, as explained [here](https://docs.djangoproject.com/en/dev/topics/db/managers/#manager-types).