models.py 684 B

1234567891011121314151617181920
  1. from django.contrib.auth.models import User
  2. from django.db import models
  3. # 实体表,需要migrate
  4. class DailyReport(models.Model):
  5. # 标题字段,最长50
  6. title = models.CharField(max_length=50)
  7. # 文本字段
  8. content = models.TextField()
  9. # 创建时间,只有在创建的时候会自动填充当前时间
  10. create_at = models.DateField(auto_now_add=True)
  11. # 创建人,外键类型
  12. create_by = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE)
  13. class Meta:
  14. app_label = 'workreport'
  15. db_table = 'workreport_daily'
  16. verbose_name = '工作汇报'
  17. verbose_name_plural = '工作汇报列表'