You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thank you for creating this package.
I created the MediaType model, which is made of IntegerChoices:
from django.db.models import IntegerChoices, TextChoices
class MediaType(IntegerChoices):
PHOTO = 1, _('Photo')
VIDEO_IGTV_REAL = 2, _('Video / IGTV / Reel')
ALBUM = 8, _('Album')
Then I used it in the desired field in the ResourcePage model:
from extensions.choices import MediaType
from multiselectfield import MultiSelectField
class ResourcePage(models.Model):
media_type = MultiSelectField(
verbose_name=_('Media Type'),
choices=MediaType.choices,
min_choices=1
)
Finally, my tests encounter the following error:
File "/home/***/PycharmProjects/PhinixAutomation/.venv/lib/python3.8/site-packages/multiselectfield/db/fields.py", line 145, in get_db_prep_value
value = self.get_prep_value(value)
File "/home/***/PycharmProjects/PhinixAutomation/.venv/lib/python3.8/site-packages/multiselectfield/db/fields.py", line 141, in get_prep_value
return '' if value is None else ",".join(map(str, value))
TypeError: 'MediaType' object is not iterable
The text was updated successfully, but these errors were encountered:
Hello, thank you for creating this package.
I created the
MediaType
model, which is made ofIntegerChoices
:Then I used it in the desired field in the
ResourcePage
model:Finally, my tests encounter the following error:
The text was updated successfully, but these errors were encountered: