The following is my device model:
class Device(models.Model):
device_type = models.ForeignKey(DeviceType,to_field='device_type')
serial_number = models.CharField(max_length=200,unique=True)
in_use_by = models.ForeignKey(User,to_field='username')
brand = models.CharField(max_length=200,default="-", null=False)
model = models.CharField(max_length=200,default="-", null=False)
type_number = models.CharField(max_length=200,blank=True,null=True, default = None)
mac_address = models.CharField(max_length=200,blank=True,null=True, default = None)
invoice = models.FileField(upload_to='', null=True)
Here, the invoice field is not of use to me in my website but, it is of use to me as a admin. What I am basically trying to do is, if a device request is accepted then, I will upload the invoice of the device into my sqlite db using the admin panel. I am a newbie to Django and hence, require help for this purpose. Also, I will only upload file through django admin. How should I achieve this? What should I write in upload to parameter so that the file is stored in database?