Boxtitoli_Django/titoli/models.py

20 lines
544 B
Python

from django.db import models
from django.urls import reverse
# Create your models here.
class Titolo(models.Model):
titolo = models.CharField(max_length=300)
slug_id = models.CharField(max_length=11,null=True,blank=True)
link_embedded = models.URLField()
foto = models.URLField()
def __str__(self):
return self.titolo
def get_absolute_url(self):
return reverse('guarda_streaming',kwargs={"slug_id":self.slug_id})
class Meta:
verbose_name = "Titolo"
verbose_name_plural = "Titoli"