from django.db import models
import uuid
from django.conf import settings

class Device(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True)
    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='devices')
    last_login = models.DateTimeField(auto_now=True)
    device_model = models.CharField(max_length=100, blank=True, null=True)

    def __str__(self):
        return f"{self.user.username} : {self.device_model}"
