MultiSelectField with choice from model object?
koddr opened this issue · 1 comments
koddr commented
Hello.
One little question about your awesome package: how to make MultiSelectField
with choice from model object?
For example, I have this model:
from money_currencies.models import MoneyCurrency
class Country(models.Model):
"""
Country model
"""
name = models.CharField(max_length=255)
currency = MultiSelectField(choices=MoneyCurrency.objects.all(), min_choices=1)
...
It's raise error:
TypeError at /admin/countries/country/add/
__str__ returned non-string (type __proxy__)
How to solve this and use model for choices? Thanks!
blag commented
This is not really possible with Django - you would be importing models when these models are imported, which could very easily lead to circular references. Furthermore, that's not what this package is designed to support.
For your use case you should use Django's built-in ManyToManyField.