website/hub/services/migrations/0034_article.py

119 lines
4.3 KiB
Python
Raw Normal View History

2025-06-06 14:53:49 +02:00
# Generated by Django 5.2 on 2025-06-06 07:47
import django.db.models.deletion
import hub.services.models.base
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0033_vshnappcatprice_public_display_enabled_and_more"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="Article",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=200)),
("slug", models.SlugField(max_length=250, unique=True)),
(
"excerpt",
models.TextField(
help_text="Brief description of the article", max_length=500
),
),
("content", models.TextField()),
(
"meta_keywords",
models.CharField(
blank=True,
help_text="SEO keywords separated by commas",
max_length=255,
),
),
(
"image",
models.ImageField(
help_text="Title picture for the article",
upload_to="article_images/",
validators=[hub.services.models.base.validate_image_size],
),
),
(
"is_published",
models.BooleanField(
default=False,
help_text="Only published articles are visible to users",
),
),
(
"is_featured",
models.BooleanField(
default=False,
help_text="Featured articles appear prominently in listings",
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="articles",
to=settings.AUTH_USER_MODEL,
),
),
(
"related_cloud_provider",
models.ForeignKey(
blank=True,
help_text="Link this article to a cloud provider",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="articles",
to="services.cloudprovider",
),
),
(
"related_consulting_partner",
models.ForeignKey(
blank=True,
help_text="Link this article to a consulting partner",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="articles",
to="services.consultingpartner",
),
),
(
"related_service",
models.ForeignKey(
blank=True,
help_text="Link this article to a specific service",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="articles",
to="services.service",
),
),
],
options={
"verbose_name": "Article",
"verbose_name_plural": "Articles",
"ordering": ["-created_at"],
},
),
]