# loop through the models and their fields to find in which model the
# metric comes from
for model in apps.get_models():
model_name = model.__name__.lower()
for field in model._meta.get_fields():
if (field.name == form_metric) and (model_name == form_model):
metric_filter_dict[model_name] = f"{model_name}__{field.name}"
assert metric_filter_dict, f"{form_metric} does not exist in any model"
This confused me because my error during testing was in the (model_name == form_model) rather than the form_metric. So add model name in the assertion message
This confused me because my error during testing was in the
(model_name == form_model)
rather than theform_metric
. So add model name in the assertion message