imagno

models.py

Mar 22nd, 2022
1,564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from django.db import models
  2. import uuid
  3. import string
  4. import random
  5.  
  6.  
  7. class Usuarios(models.Model):
  8.   default_key = ''.join(
  9.     random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10)
  10.   )
  11.  
  12.   id = models.UUIDField(
  13.     primary_key=True,
  14.     default=uuid.uuid4,
  15.     null=False,
  16.     blank=True,
  17.   )
  18.   login = models.CharField(
  19.     max_length=8,
  20.     null=False,
  21.     blank=False,
  22.     unique=True,
  23.   )
  24.   senha = models.CharField(
  25.     max_length=15,
  26.     default=default_key,
  27.     null=False,
  28.     blank=True,
  29.   )
  30.   data_nascimento = models.DateField(
  31.     null=False,
  32.     blank=False,
  33.   )
Advertisement
Add Comment
Please, Sign In to add comment