- Arduino Uno
- 2x MAX6675 w/ thermocouple
Recently I worked on a bug that was causing duplicate unformatted log messages to appear in a Django app's logs. I made a repository that demonstrates the issue: https://github.com/pawl/django_duplicate_unformatted_logs_example
The problem was caused by an accidental call to
logging.info (without using
logging.getLogger to get a specific logger) while the root logger isn't already configured.
The solution ended up being to get rid of the accidental calls to
logging.info and configuring the root logger to prevent it from accidentally happening again. I go into more details in that repo.
It would be nice to know a better way to cache the ModelChoiceField’s queryset when it’s used in a form that runs “is_valid()” in a loop (like Formsets do). The best way I know how at the moment is by not using a ModelChoiceField at all. The solution requires using a ChoiceField, running the query for choices outside of the loop, then passing the choices into the form to override the ChoiceField choices.
Here’s an example: