我有以下模型,我需要创建一个表单,该表单允许更新现有响应(之前使用 slug 生成,然后通过电子邮件发送给受访者)并Rating
为每个CV
in CV.objects.all()
. 在 Django 中执行此操作的最简单方法是什么。目前我有一个基于类的 UpdateView 用于响应,就是这样。
class Response(models.Model):
first_name = models.CharField(max_length=200, null=True, blank=True)
last_name = models.CharField(max_length=200, null=True, blank=True)
email = models.EmailField(max_length=254)
slug = models.SlugField(max_length=32)
submited = models.BooleanField(default=False)
submit_time = models.DateTimeField(null=True, blank=True)
creation_time = models.DateTimeField(auto_now_add=True)
class CV(models.Model):
title = models.CharField(max_length=200)
image = models.ImageField(upload_to=content_file_name)
class Rating(models.Model):
cid = models.ForeignKey('CV')
rid = models.ForeignKey('Response')
score = models.IntegerField()
comment = models.TextField()