Replace WYSIWYG editor with Markdown editor across all relevant models and admin fields. Add utilities for rendering and stripping markdown. Adjust serializers, views, and templates to support markdown content. Introduce `PastedImage` model and upload endpoint for handling inline image uploads in markdown. This change simplifies content formatting while enhancing flexibility with markdown support.
88 lines
3 KiB
Python
88 lines
3 KiB
Python
# Generated by Django 5.2.11 on 2026-02-27 20:25
|
|
|
|
import uuid
|
|
|
|
import django_extensions.db.fields
|
|
from django.db import migrations, models
|
|
|
|
import engine.core.models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("core", "0055_alter_brand_categories_alter_product_slug"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="PastedImage",
|
|
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",
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
help_text="descriptive name for the image",
|
|
max_length=100,
|
|
verbose_name="name",
|
|
),
|
|
),
|
|
(
|
|
"image",
|
|
models.ImageField(
|
|
help_text="image file pasted in the markdown editor",
|
|
upload_to=engine.core.models.get_pasted_image_path,
|
|
verbose_name="image",
|
|
),
|
|
),
|
|
(
|
|
"alt_text",
|
|
models.CharField(
|
|
blank=True,
|
|
default="",
|
|
help_text="alternative text for accessibility",
|
|
max_length=255,
|
|
verbose_name="alt text",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "pasted image",
|
|
"verbose_name_plural": "pasted images",
|
|
"ordering": ("-created",),
|
|
},
|
|
),
|
|
]
|