Files
url_shortener/short_url/models.py
2024-11-14 02:06:21 +08:00

13 lines
366 B
Python

from django.db import models
from url_shortener.utils import generate_random_string_3
class ShortUrl(models.Model):
alias = models.CharField(
max_length=120, unique=True, default=generate_random_string_3
)
target = models.URLField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)