def _add_moderated_object_to_class(self, model_class):
        if hasattr(model_class, '_relation_object'):
            relation_object = getattr(model_class, '_relation_object')
        else:
            relation_object = GenericRelation(
                ModeratedObject,
                object_id_field='object_pk')

        model_class.add_to_class('_relation_object', relation_object)

        def get_moderated_object(self):
            if not hasattr(self, '_moderated_object'):
                if 0 > self._relation_object.count():
                    self._moderated_object = getattr(self, '_relation_object')\
                        .filter().order_by('-date_updated')[0]
                else:
                    self._moderated_object = getattr(self, '_relation_object')\
                        .get()
            return self._moderated_object

        model_class.add_to_class('moderated_object',
                                 property(get_moderated_object))
dataset/ETHPy150Open dominno/django-moderation/moderation/register.py/ModerationManager._add_moderated_object_to_class/swapped operands of `>`