1👍
✅
If you just want to update the status
field:
class FileManager(models.Manager):
def get_new_files(self, json_output=None, update=None):
files = (self.filter(status=File.PENDING_STATUS)) \
.values('name', 'link', 'size', 'token__userid', 'token__credentials')
self.filter(status=File.PENDING_STATUS).update(status=File.PROGRESS)
See the docs on QuerySet.update
method. Note that you can’t chain values()
and update()
methods in the same call.
Source:stackexchange.com