goinnn/django-multiselectfield

How do you even add/remove a value?

Closed this issue · 2 comments

I expected some kind of interaction with the field to add and remove values manually. However it just returns a string... How am I even able to instance.multiselectfield.add(value)? It just seems to behave like a normal text field.

@kpagcha You cant, you have to assign a new list of the values you intend the field to have, like so:

object.achievements = ['newbie', 'verteran']
object.save()

I had to spend at least an hour to figure this out

blag commented

Correct, you can't, you just have to overwrite the list. This package is a bit of a hack, and sometimes M2M fields make more sense for your application.