[Fixed]-Django: How to print to logs the value of a database field?

1👍

There’s no reason to be using F objects here. Those are useful when doing an update query directly, but here you have the object already. Just reference the values:

survey_counter.survey_wizard_count += 1 
survey_counter.total_max_counter += 1 
survey_counter.save()

Now you can log the values directly:

logger.debug('This is your survey_wizard_count = %s', survey_counter.survey_wizard_count)

0👍

You may try:

logger.debug("This is your survey_wizard_count is: " + survey_counter.survey_wizard_count)

Leave a comment