code: def related_items_changed(self, instance, related_manager):
          
          try:
              count = related_manager.count_queryset()
          except AttributeError:
              count = related_manager.count()
          count_field_name = list(self.fields.keys())[0] % \
                             self.related_field_name
          setattr(instance, count_field_name, count)
          instance.save()
docs: Stores the number of comments. A custom ``count_filter``
          queryset gets checked for, allowing managers to implement
          custom count logic.