from myapp.models import User
from django.db import models
class UserRequestImage(models.Model):
user_request = models.ForeignKey('UserRequest', related_name='images', on_delete=models.CASCADE)
image = models.ImageField(upload_to='user_requests/')
uploaded_at = models.DateTimeField(auto_now_add=True)
class UserFeedbackImage(models.Model):
user_feedback = models.ForeignKey('UserFeedback', related_name='images', on_delete=models.CASCADE)
image = models.ImageField(upload_to='user_feedbacks/')
uploaded_at = models.DateTimeField(auto_now_add=True)
class UserRequest(models.Model):
"""用户需求表"""
PRIORITY_CHOICES = [
(1, '非常低'),
(2, '低'),
(3, '常规'),
(4, '高'),
(5, '非常高'),
]
STATUS_CHOICES = (
(1, '待处理'),
(2, '处理中'),
(3, '已完成'),
)
title = models.CharField(max_length=255, verbose_name='需求标题')
description = models.TextField(verbose_name='需求描述')
user = models.ForeignKey('User', on_delete=models.CASCADE, verbose_name='用户')
priority = models.IntegerField(choices=PRIORITY_CHOICES, default=2, verbose_name='优先级')
status = models.IntegerField(choices=STATUS_CHOICES, default=1, verbose_name='状态')
progress = models.IntegerField(default=0, verbose_name='进度') # 新增进度字段
created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')
class UserFeedback(models.Model):
"""用户反馈建议表"""
FEEDBACK_TYPE_CHOICES = (
(1, '建议'),
(2, '问题'),
(3, '其他'),
)
STATUS_CHOICES = (
(1, '待处理'),
(2, '处理中'),
(3, '已完成'),
)
content = models.TextField(verbose_name='反馈内容')
user = models.ForeignKey('User', on_delete=models.CASCADE, verbose_name='用户')
feedback_type = models.IntegerField(choices=FEEDBACK_TYPE_CHOICES, default=1, verbose_name='反馈类型')
status = models.IntegerField(choices=STATUS_CHOICES, default=1, verbose_name='状态')
created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')
评论