The reset_popularity management command and the get_most_popular
templatetag use a callback function to get a queryset of a specific model.
By default, the used callback just do model.obejcts.all() but
you can customize this behaviour defining a callable path in
settings.POPULARITY_QUERYSET_CALLBACK. The callback takes as
arguments the Django model and a patch function that can be used
to join the model to corresponding content type when the queryset is
ordered by rank. The default patch function can be found in
popularity.shortcuts:

def patch(queryset):
"""
Patch a queryset that you want to order by rank.
"""
content_type = ContentType.objects.get_for_model(queryset.model)
return queryset.filter(ranks__content_type=content_type.pk)

So, if you want to exclude inactive instances from the model queryset, you
can write a POPULARITY_QUERYSET_CALLBACK as follows: