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

Actually doesnt support django version 4 #339

Open
DARKDEYMON opened this issue Dec 17, 2021 · 11 comments
Open

Actually doesnt support django version 4 #339

DARKDEYMON opened this issue Dec 17, 2021 · 11 comments

Comments

@DARKDEYMON
Copy link
Contributor

Actually doesnt support django version 4 in pip

@luigi370
Copy link

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.

@sdsy888
Copy link

sdsy888 commented Dec 29, 2021

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

@xs2hamzashah
Copy link

xs2hamzashah commented Feb 24, 2022

Thanks, man you made my life easy

@Audiopolis
Copy link

Same issue here.

@facundopadilla
Copy link

already updated or not?

@Audiopolis
Copy link

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.

@facundopadilla
Copy link

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.

@pareshpandit
Copy link

pareshpandit commented Jun 10, 2022

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.)

@iserranoe
Copy link

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

Where should I include this code?

@kfirufk
Copy link

kfirufk commented Aug 16, 2022

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')),
]

@amegianeg
Copy link

Tried in a small PoC with Django 4.2.8 and Python 3.11 and seems to be working fine.

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

10 participants