Open DARKDEYMON opened 2 years ago
I got the same problem.. but if you install it from the repo like this (pipenv)
django-smart-selects = {editable = true, ref = "master", git = "https://github.com/jazzband/django-smart-selects.git"}
it works for me.
same problem spotted.
For the self-saving solution, I have to change all the force_text
to force_str
like this:
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding import force_str as force_text
and all the places using the url
to this( because the url
method has been removed in Django4.0):
try:
from django.conf.urls.defaults import url
except ImportError:
from django.urls import re_path as url
Thanks, man you made my life easy
Same issue here.
already updated or not?
already updated or not?
Not that I can see unless you use custom models. My best options were to either not use Django v4 or not use django-smart-selects. Decided on Django v3.2 for now.
ya actualizado o no?
No es que pueda verlo a menos que use modelos personalizados. Mis mejores opciones eran no usar Django v4 o no usar django-smart-selects. Decidí Django v3.2 por ahora.
I just did the same thing, downgraded to 3.1 and it works without problems.
Confirmation / Update & Request
Indeed, I faced this too. Then, realised that pip seems to pull a really old repo, and the syntaxes therein are super deprecated.
Best advised to download the latest repo from GitHub, and use it instead. It works just fine with Django 4 & Python 3.10. [As for me, since I had already pulled the earlier one vide pip, I simply replaced the files, from a local download.]
Can the versioning not be forced to upgrade @ pip somehow? :) (Sorry, I am not very familiar with how things work out there, am a noob.)
same problem spotted.
For the self-saving solution, I have to change all the
force_text
toforce_str
like this:try: from django.utils.encoding import force_text except ImportError: from django.utils.encoding import force_str as force_text
and all the places using the
url
to this( because theurl
method has been removed in Django4.0):try: from django.conf.urls.defaults import url except ImportError: from django.urls import re_path as url
Where should I include this code?
works amazing with django 4.1 for urls do this:
from django.contrib import admin
from django.urls import path, include, re_path
urlpatterns = [
path('admin/', admin.site.urls),
re_path(r'^chaining/', include('smart_selects.urls')),
]
Tried in a small PoC with Django 4.2.8 and Python 3.11 and seems to be working fine.
Actually doesnt support django version 4 in pip