1234567891011121314151617181920 |
- from django.db import models
- from django.contrib.auth.models import User
- # Create your models here.
- # 聊天记录表
- class Message(models.Model):
- # 消息id
- message_id = models.AutoField(primary_key=True)
- # 是否已接收
- is_received = models.BooleanField(default=False)
- # 消息来源
- fromUser = models.ForeignKey(User, on_delete=models.CASCADE, related_name='from_user')
- # 消息去向
- toUser = models.ForeignKey(User, on_delete=models.CASCADE, related_name='to_user')
- # 消息日期
- date = models.DateTimeField(auto_now_add=True)
- # 消息内容
- plaintext = models.CharField(max_length=2048)
|