I am trying to use MultipleChoiceField from django Rest Framework fields as described in this link: https://pypi.org/project/django-multiselectfield/
A part of my code snippet is as below:
from rest_framework import fields
CHOICES = (
('publisher', 'Can Publish programs'),
('author', 'Can author programs')
)
class User(AbstractUser):
email = EmailField(verbose_name=_('email address'), unique=True)
edumap_roles = fields.MultipleChoiceField(choices=CHOICES, allow_blank=True)
But on admin console I see these fields like, instead of string items:
But when I click on email_addres to see user details, I get following error:
Edit: This is my UserAdmin class
@register(User)
class UserAdmin(CustomAdmin):
"""Define admin model for custom User model with no email field."""
fieldsets = (
(None, {'fields': ('email', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name')}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
'groups', 'user_permissions', 'edumap_roles')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined',
'created_at', 'updated_at')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('email', 'password1', 'password2'),
}),
)
list_display = ('email', 'first_name', 'last_name', 'is_staff', 'edumap_roles')
search_fields = ('email', 'first_name', 'last_name')
ordering = ('email',)
readonly_fields = ['created_at', 'updated_at']
My rest framework version is: 3.11.0. Am I missing to add anything?