1

I am using AWS S3 for image storage for my userprofile images, and need to use AJAX to set the image URL in the database. I have django-storage / Boto setup correctly so that my media url is my S3 account so that is not the problem. I have tested this and it works.

I have been tyring to implement this: https://github.com/sigurdga/django-jquery-file-upload and although I can get it to work as a stand-alone app for testing, I am having a very hard time customizing it to fit my Model and app views.

My questions are as follows:

  1. Is there a simple, stripped down version of django-jquery-file-upload that just has the functional/non-ui elements, or better documentation on how to implement/customize this?
  2. Is there a better way to do a simple JQuery / Ajax / ImageUpload call within Django? I have found a lot of tutorials, but they all seem overkill for the simple need I have.

Here is an overview of my UserProfile model:

class UserProfile(models.Model):
    user = models.OneToOneField(User) 
    user_image = file = models.FileField(upload_to="/profile_images", default="/assets/img/default-user-image.png", blank=True)

    def __unicode__(self):
        return self.user.username

If the problem is too complex, even an overview of what needs to be done at a high level would be excellent at this point. Still trying to wrap my head around all this.

Thanks for your help!

bevinlorenzo
  • 486
  • 7
  • 18

0 Answers0