Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent failure if model name is incorrect #28

Open
andreyshipilov opened this issue Nov 4, 2018 · 4 comments
Open

Silent failure if model name is incorrect #28

andreyshipilov opened this issue Nov 4, 2018 · 4 comments

Comments

@andreyshipilov
Copy link

andreyshipilov commented Nov 4, 2018

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
Copy link
Author

andreyshipilov commented Nov 4, 2018

My bad. SHORTEN_MODELS key values should be lowercase.

SHORTEN_MODELS = {
    'E': 'experiences.photo', #  Not Photo.
}

@bfirsh
Copy link
Owner

bfirsh commented Nov 4, 2018

Hm - this should probably throw an error though, shouldn't it?

@bfirsh bfirsh reopened this Nov 4, 2018
@andreyshipilov
Copy link
Author

@andreyshipilov Most likely, but not in templates.

@bfirsh
Copy link
Owner

bfirsh commented Nov 4, 2018

Indeed... it should probably validate the configuration on bootup to make sure the models actually exist.

@bfirsh bfirsh changed the title Should it work with Django 1.11+? Silent failure if model name is incorrect Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants