This commit is contained in:
Ross
2021-09-09 16:47:05 +01:00
parent ff86ad2a54
commit 62af5645a2
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -124,6 +124,11 @@ class QuestionNote(models.Model):
#author = models.ForeignKey(User, #author = models.ForeignKey(User,
author = models.CharField(max_length=200, blank=True) author = models.CharField(max_length=200, blank=True)
user_author = models.ForeignKey( settings.AUTH_USER_MODEL,
related_name="rapid_notes",
on_delete=models.CASCADE, blank=True)
note = models.TextField() note = models.TextField()
created_on = models.DateTimeField(auto_now_add=True) created_on = models.DateTimeField(auto_now_add=True)
+1
View File
@@ -209,6 +209,7 @@ class AddQuestionNote(CreateView):
kwargs = super(AddQuestionNote, self).get_form_kwargs() kwargs = super(AddQuestionNote, self).get_form_kwargs()
# update the kwargs for the form init method with yours # update the kwargs for the form init method with yours
kwargs.update(self.kwargs) # self.kwargs contains all url conf params kwargs.update(self.kwargs) # self.kwargs contains all url conf params
kwargs.update({"user": self.request.user})
return kwargs return kwargs
def get_initial(self): def get_initial(self):