django-shorturls
django-shorturls copied to clipboard
Silent failure if model name is incorrect
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?
My bad. SHORTEN_MODELS key values should be lowercase.
SHORTEN_MODELS = {
'E': 'experiences.photo', # Not Photo.
}
Hm - this should probably throw an error though, shouldn't it?
@andreyshipilov Most likely, but not in templates.
Indeed... it should probably validate the configuration on bootup to make sure the models actually exist.