muistox/gallery/models/redir.py

15 lines
436 B
Python
Raw Normal View History

from django.db import models
from gallery.models import Album
class Redir(models.Model):
path = models.CharField(max_length=255, db_index=True, unique=True, verbose_name="Path")
album = models.ForeignKey(Album, on_delete=models.CASCADE, related_name='pathurl', verbose_name="Album")
class Meta:
verbose_name_plural = "Redirs"
def __str__(self):
return '{0} - {1}'.format(self.path, self.album.slug)