ljg.sh/ljg/redirect/models.py

12 lines
316 B
Python
Raw Permalink Normal View History

2023-10-16 21:42:51 +02:00
from django.contrib.auth.models import User
from django.db import models
class Redirect(models.Model):
name = models.SlugField(primary_key=True)
target = models.URLField()
owner = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
def get_absolute_url(self):
return self.target