class AttachmentManager models Manager def upload_new_file self user f

1
2
3
4
5
class AttachmentManager(models.Manager):
def upload_new_file(self, user, file):
new_item = self.model(user=user)
new_item.attachment.save(file['filename'], file['content'], save=True)
return new_item