What are the alternatives to the MultiSelectField library for Django 5?

114 Views Asked by At
ROLES = [
    ("admin", "Администратор"),
    ("user", "Пользователь"),
]

class Permission(models.Model):
    title = models.CharField(max_length=100)
    roles = MultiSelectField(choices=ROLES)

I need to implement this functionality. However, the MultiSelectField library does not work with Django 5 version. To fix this, you need to remove _get_flatchoices from the fields.py file in the root of the library. However, when installing dependencies via requirements.txt when deploying to the server, this will not work. Help me please

I wanted to use ArrayField, but this is not suitable since the Sqlite database is used locally

1

There are 1 best solutions below

0
On

I found a way to solve my problem. I created a Libs folder in my project, where I added the corrected MultiSelectField library code. Now when using MultiSelectField I will import it from this libs Libs