I need to use a get() to select an object by comparing it with a FILE request:
My models:
class Work (models.Model):
file = models.FileField(storage=OverwriteStorage(), upload_to=path)
class Group(models.Model):
members = models.ManyToManyField(User, related_name='group_list', null=True, blank=True)
I have tried: var = mygroup.work_list.get(file=request.FILES['file'])
With the same file: Work matching query does not exist
I prefer in reality to compare the name of file but that doesn't works too:
var = mygroup.work_list.get(file__name=request.FILES['file'].name)
It seems I can't make a request whith informations about file, I have tried with size Join on field 'file' not permitted. Did you misspell 'size' for the lookup type?I have the same message with name...
You can try generating and storing a md5-hash of the file and compare with this key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With