Invalid error handling in `get_solo` tag
Closed this issue · 1 comments
Viicos commented
The following:
django-solo/solo/templatetags/solo_tags.py
Lines 20 to 29 in e06af9a
shouldn't happen, as get_model
will raise a LookupError
if the app and/or model doesn't exist. It should probably be:
try:
model_class: type[SingletonModel] = apps.get_model(app_label, model_name)
except LookupError:
raise template.TemplateSyntaxError(
_(
"Could not get the model name '{model}' from the application named '{app}'"
).format(model=model_name, app=app_label)
)
return model_class.get_solo()
johnthagen commented
@Viicos If you are able to fix and add a test, that would be awesome.