how to change a char field to list field or array field in Django model?

I want the Char field "device_id" to be changed to a list field or an array field without loosing the current data present in the field , so it can hold multiple device ids.

class User(AbstractBaseUser, PermissionsMixin):
    id = ShortUUIDField(primary_key=True, editable=False)
    email = models.EmailField(verbose_name="email address", max_length=255, unique=True)
    phone = models.CharField(max_length=50, null=True)
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    device_id = models.CharField(max_length=255, blank=True, null=True)

Usecase :I need the user to be associated with multiple devices here after



Read more here: https://stackoverflow.com/questions/67397188/how-to-change-a-char-field-to-list-field-or-array-field-in-django-model

Content Attribution

This content was originally published by ajith siva at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: