Silent failure if model name is incorrect
andreyshipilov opened this issue · 4 comments
andreyshipilov commented
I have an object in the context named experience
and all the attributes from this objects are shown correctly on the page. Although this:
{% load shorturl %}
{% shorturl experience %}
Produces an empty result. shorturls
is in INSTALLED_APPS
and url('^short/', include('shorturls.urls'))
is in urls.py
. The object has get_absolute_url()
method which works correctly.
Am I missing something?
andreyshipilov commented
My bad. SHORTEN_MODELS
key values should be lowercase.
SHORTEN_MODELS = {
'E': 'experiences.photo', # Not Photo.
}
bfirsh commented
Hm - this should probably throw an error though, shouldn't it?
andreyshipilov commented
@andreyshipilov Most likely, but not in templates.
bfirsh commented
Indeed... it should probably validate the configuration on bootup to make sure the models actually exist.