[Solved] I wanna resist id in serial number


UUID is not a number but you can generate a new UUID simple

import uuid
from django.db import models

# Create your models here.
def get_next():
    return uuid.uuid4()

class Users(models.Model):
    id = models.UUIDField(primary_key=True, default=get_next, editable=False)
    sex = models.CharField(max_length=100, null=True, default=None)
    age = models.CharField(max_length=100, null=True, default=None)

By default Django will store Integer Primary keys. In order to do that you need to remove some of your code.

from django.db import models


class Users(models.Model):
    sex = models.CharField(max_length=100, null=True, default=None)
    age = models.CharField(max_length=100, null=True, default=None)

Pending on you database backend it will be sequential.

1

solved I wanna resist id in serial number