ljg.sh/ljg/redirect/models.py

12 lines
316 B
Python

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