[Fixed]-Relative import django models in views

1👍

It would help to know what version of Python you’re using, but I would guess it’s Python 3. To quote PEP 8:

Implicit relative imports should never be used and have been removed in Python 3.

I would recommend reading through the section of PEP 8 on imports, here: https://www.python.org/dev/peps/pep-0008/#imports

And if you want to read more about the topic, I would suggest PEP 328, which goes into far more detail about the rationale for absolute vs relative imports.

Here is an other link with a more clear description on python 3 relative imports:

Changes in import statement python3

Leave a comment