[Python] Automatic generate data in table when migrate in Django

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    Im having trouble how to migrate data with value in Django is there any way how can I add automatically data in tables when using command migrations in Django? Let say I have usertype_tbl every time I use command makemigrations in Django it should store automatically this data - Admin, Super admin, other_user etc. in usertype_tbl. Is there any way how to implement this? or any solution and ideas aside from migrations please help me ,thanks for the help in advance!


    models.py
    ​

    class usertypes_tbl(models.Model):
    user_type = models.CharField(max_length=264)
    description = models.CharField(max_length=264)
    status = models.CharField(max_length=264)
    //add some data = Admin, Super_admin , etc.

    Continue reading...

Compartilhe esta Página