65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
import uuid
|
|
|
|
import django.db.models.deletion
|
|
import django_extensions.db.fields
|
|
from django.db import migrations, models
|
|
|
|
import engine.core.utils
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("core", "0008_digitalassetdownload"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Documentary",
|
|
fields=[
|
|
(
|
|
"uuid",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="unique id is used to surely identify any database object",
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="unique id",
|
|
),
|
|
),
|
|
(
|
|
"is_active",
|
|
models.BooleanField(
|
|
default=True,
|
|
help_text="if set to false, this object can't be seen by users without needed permission",
|
|
verbose_name="is active",
|
|
),
|
|
),
|
|
(
|
|
"created",
|
|
django_extensions.db.fields.CreationDateTimeField(
|
|
auto_now_add=True,
|
|
help_text="when the object first appeared on the database",
|
|
verbose_name="created",
|
|
),
|
|
),
|
|
(
|
|
"modified",
|
|
django_extensions.db.fields.ModificationDateTimeField(
|
|
auto_now=True, help_text="when the object was last modified", verbose_name="modified"
|
|
),
|
|
),
|
|
("document", models.FileField(upload_to=engine.core.utils.get_product_uuid_as_path)),
|
|
(
|
|
"product",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE, related_name="documentaries", to="core.product"
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "documentary",
|
|
"verbose_name_plural": "documentaries",
|
|
},
|
|
),
|
|
]
|