Я пытаюсь добавить запрос пользователя в модель.
def fileupload(request):
files = Download.objects
if request.method == "POST" :
form = DownloadForm(request.POST, request.FILES)
if form.is_valid():
author = request.user
savefile = form.save()
savefile.save()
Мои модели:
class Download(models.Model):
author = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
workspace = models.ForeignKey(Workspace, on_delete=models.CASCADE, related_name="filedownload")
upload = models.FileField(upload_to='uploads/')
Но автор не обновляет, какая-либо подсказка?