1

I wanted to use the django smart select library to create related dropdowns. I did everything as indicated in the library documentation, but an error occurs:

import "smart_selects.db_fields" could not be resolved Pylance(reportMissingImports) [Ln2, Col6]

Even when I enter "import ..." the library itself already glows gray, as if it does not find it.

This is what my INSTALLED_APPS in settings.py looks like:

INSTALLED_APPS = [
    'routes_form.apps.RoutesFormConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'smart_selects',
]


USE_DJANGO_JQUERY = True

This is my urls.py:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('form/', include('routes_form.urls')),
    path('admin/', admin.site.urls),
    path(r'^chaining/', include('smart_selects.urls')),
]

...and my model.py:

from django.db import models
from smart_selects.db_fields import ChainedForeignKey

I tried to find a solution to the problem, looked for possible options. That is why I already changed from `JQUERY_URL = True` to `USE_DJANGO_JQUERY = True`. Errors (six) I did not take off.

I have only this...:

`import "smart_selects.db_fields" could not be resolved Pylance(reportMissingImports) [Ln2, Col6]`

I would be incredibly grateful even for trying to help.

SOLUTION: Just need typing in the path to library 'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS

1 Answers1

0

You can use:

USE_DJANGO_JQUERY = True instead of JQUERY_URL = True in your 
settings.py

Please reply to this message if the issue still persist.

  • 1
    It turns out the problem was that VS Code was looking for the library in the wrong place. And so it was necessary to show the way. – Oleksandr Lager Nov 29 '22 at 20:04