我有以下模型,我想为模型使用dropzone.js
。
我尝试过django-dropzone,但是我只能上传文件,而不能上传像author
,title
,description
这样的描述。
class File(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
author = models.ForeignKey(User, on_delete=models.CASCADE)
visible_to_home = models.ManyToManyField(Home, blank=True) # when none visible to all home
visible_to_company = models.ManyToManyField(Company, blank=True)
# when none visible to all company
# To determine visibility, check if vtc is none or include company of user and if true, check same for home
created_date = models.DateTimeField(auto_now=True)
published = models.BooleanField(default=True)
upload = models.FileField(blank=True, null=True, upload_to=update_filename)
title = models.CharField(max_length=225, blank=True, null=True)
description = models.TextField(blank=True, null=True)