new
This commit is contained in:
18
backend/community/migrations/0005_topic_category.py
Normal file
18
backend/community/migrations/0005_topic_category.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 6.0.1 on 2026-02-12 06:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('community', '0004_activity_banner_url_alter_activity_banner'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='topic',
|
||||
name='category',
|
||||
field=models.CharField(choices=[('discussion', '技术讨论'), ('help', '求助问答'), ('share', '经验分享'), ('notice', '官方公告')], default='discussion', max_length=20, verbose_name='分类'),
|
||||
),
|
||||
]
|
||||
@@ -71,6 +71,15 @@ class Topic(models.Model):
|
||||
论坛帖子/主题
|
||||
"""
|
||||
title = models.CharField(max_length=200, verbose_name="标题")
|
||||
|
||||
CATEGORY_CHOICES = (
|
||||
('discussion', '技术讨论'),
|
||||
('help', '求助问答'),
|
||||
('share', '经验分享'),
|
||||
('notice', '官方公告'),
|
||||
)
|
||||
category = models.CharField(max_length=20, choices=CATEGORY_CHOICES, default='discussion', verbose_name="分类")
|
||||
|
||||
content = models.TextField(verbose_name="内容", help_text="支持Markdown格式,支持插入图片")
|
||||
author = models.ForeignKey(WeChatUser, on_delete=models.CASCADE, related_name='topics', verbose_name="作者")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user