from django.db import models
from django.contrib.auth.models import BaseUserManager
from rest_framework_simplejwt.tokens import RefreshToken

# Create your models here.
class UserManager(BaseUserManager):
    def create_user(self, username, email, telefono, programa):
        if username is None:
            raise TypeError('El usuario no se ha ingresado')

        if email is None:
            raise TypeError('El correo no se ha ingresado')

        user = self.model(username=username, email=self.normalize_email(email),programa=programa, telefono=telefono)
        user.save()
        return user

class InfoUser(models.Model):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    telefono = models.IntegerField()
    programa = models.CharField(max_length=255, unique=True, db_index=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    objects = UserManager()

    def __str__(self):
        return self.email

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {
            'refresh': str(jwt_token),
            'access': str(jwt_token.access_token),
        }


29b181fc33e3d9896a894af514cb49f5e39c05e3
<mask token>


class InfoUser(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {'refresh': str(jwt_token), 'access': str(jwt_token.
            access_token)}

<mask token>


class UserManager(BaseUserManager):
    <mask token>


class InfoUser(models.Model):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    telefono = models.IntegerField()
    programa = models.CharField(max_length=255, unique=True, db_index=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    objects = UserManager()

    def __str__(self):
        return self.email

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {'refresh': str(jwt_token), 'access': str(jwt_token.
            access_token)}

<mask token>


class UserManager(BaseUserManager):

    def create_user(self, username, email, telefono, programa):
        if username is None:
            raise TypeError('El usuario no se ha ingresado')
        if email is None:
            raise TypeError('El correo no se ha ingresado')
        user = self.model(username=username, email=self.normalize_email(
            email), programa=programa, telefono=telefono)
        user.save()
        return user


class InfoUser(models.Model):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    telefono = models.IntegerField()
    programa = models.CharField(max_length=255, unique=True, db_index=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    objects = UserManager()

    def __str__(self):
        return self.email

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {'refresh': str(jwt_token), 'access': str(jwt_token.
            access_token)}

from django.db import models
from django.contrib.auth.models import BaseUserManager
from rest_framework_simplejwt.tokens import RefreshToken


class UserManager(BaseUserManager):

    def create_user(self, username, email, telefono, programa):
        if username is None:
            raise TypeError('El usuario no se ha ingresado')
        if email is None:
            raise TypeError('El correo no se ha ingresado')
        user = self.model(username=username, email=self.normalize_email(
            email), programa=programa, telefono=telefono)
        user.save()
        return user


class InfoUser(models.Model):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    telefono = models.IntegerField()
    programa = models.CharField(max_length=255, unique=True, db_index=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    objects = UserManager()

    def __str__(self):
        return self.email

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {'refresh': str(jwt_token), 'access': str(jwt_token.
            access_token)}

from django.db import models
from django.contrib.auth.models import BaseUserManager
from rest_framework_simplejwt.tokens import RefreshToken

# Create your models here.
class UserManager(BaseUserManager):
    def create_user(self, username, email, telefono, programa):
        if username is None:
            raise TypeError('El usuario no se ha ingresado')

        if email is None:
            raise TypeError('El correo no se ha ingresado')

        user = self.model(username=username, email=self.normalize_email(email),programa=programa, telefono=telefono)
        user.save()
        return user

class InfoUser(models.Model):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    telefono = models.IntegerField()
    programa = models.CharField(max_length=255, unique=True, db_index=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    objects = UserManager()

    def __str__(self):
        return self.email

    def tokens(self):
        jwt_token = RefreshToken.for_user(self)
        return {
            'refresh': str(jwt_token),
            'access': str(jwt_token.access_token),
        }

