Uploading Image to database - advice

When I create a new user, a QR code is created and stored in a file path. I would like to upload the image to the customuser model and also display the QR code as a URL.

Any advice to get started would be appreciated.

See:

There are also numerous posts here discussing this topic in various degrees of detail, along with numerous blog posts and videos that can be found by searching the internet.

Have done research and most of what I find is uploading through the URL. I want to save to media/qrcodes/ as part of the view functions.

def fisher_accept(username):
        fish = CustomUser.objects.get(username=username)
        fish_qr = qrcode.make(f'{get_current_site}/accounts/signup/' + fish.alias_name)
        fish_qr.save(f'{FileSystemStorage(location='media/qrcodes/')}{fish.alias_name}.png')
fisher_accept(username='testuser')

Error
OSError: [Errno 22] Invalid argument: ‘<django.core.files.storage.filesystem.FileSystemStorage object at 0x0000028588ADAFC0>testuser.png’

This expression creates an instance of a FileSystemStorage class - and as you can see, the string representation is: <django.core.files.storage.filesystem.FileSystemStorage object at 0x0000028588ADAFC0>, which is what the error message is showing you - that’s obviously not what you want in that string.

What is the information that you’re looking to get from that object? That is what you want represented in the save method.