32 lines
750 B
Python
32 lines
750 B
Python
from django.db import models
|
|
from django.contrib.auth.models import Group
|
|
|
|
|
|
class Category(models.Model):
|
|
"""Une catégorie de contenu."""
|
|
name = models.CharField(
|
|
max_length=255,
|
|
verbose_name="Nom de la catégorie"
|
|
)
|
|
|
|
|
|
class Content(models.Model):
|
|
"""Un contenu du site (vidéo)."""
|
|
name = models.CharField(
|
|
max_length=255,
|
|
verbose_name="Nom du contenu"
|
|
)
|
|
group_owner = models.ForeignKey(
|
|
Group,
|
|
on_delete=models.CASCADE,
|
|
)
|
|
content_url = models.URLField(
|
|
verbose_name='URL du contenu',
|
|
null=True,
|
|
)
|
|
category = models.ForeignKey(
|
|
Category,
|
|
on_delete=models.SET_NULL,
|
|
verbose_name="Catégorie",
|
|
null=True
|
|
)
|