def add_taskid(self, task_id):
        """Add task_id to task_ids column in user table"""
        try:
            result = False
            user = User.query.filter_by(username=current_user.username).first()
            if user.task_ids:
                logger.debug('Current registered task_ids: {}'.format(user.task_ids))
                tasks = json.loads(user.task_ids)
            else:
                logger.debug('No task_ids registered with current user')
                tasks = None
            logger.debug('Registering new task_id to current user: {}'.format(task_id))
            if isinstance(tasks, list):
                if task_id not in tasks:
                    tasks.append(task_id)
                    result = True
                else:
                    logger.warning('task_id already registered to user: {}'.format(task_id))
            else:
                tasks = [task_id]
                result = True
            user.task_ids = json.dumps(tasks)
            db.session.commit()
            logger.debug('user.task_ids: {}'.format(user.task_ids))
            return result
        except AttributeError:
            return False
        except Exception as err:
            logger.debug('Error adding Task: {}'.format(err))
            return False
Add task_id to task_ids column in user table
crackq/cq_api.py