22 lines
822 B
Python
22 lines
822 B
Python
from django.db import models
|
|
|
|
|
|
class ContactMessage(models.Model):
|
|
name = models.CharField('姓名', max_length=50)
|
|
company = models.CharField('公司名称', max_length=100, blank=True, default='')
|
|
phone = models.CharField('电话', max_length=20)
|
|
email = models.EmailField('邮箱')
|
|
subject = models.CharField('主题', max_length=100)
|
|
message = models.TextField('留言内容')
|
|
ip_address = models.GenericIPAddressField('IP地址', blank=True, null=True)
|
|
is_read = models.BooleanField('已读', default=False)
|
|
created_at = models.DateTimeField('提交时间', auto_now_add=True)
|
|
|
|
class Meta:
|
|
ordering = ['-created_at']
|
|
verbose_name = '在线留言'
|
|
verbose_name_plural = verbose_name
|
|
|
|
def __str__(self):
|
|
return f'{self.name} - {self.subject}'
|