You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried all possibilities with this process here I have my form below, everything works fine but after I clock on upload I get redirected to the detail page with the image displaying, so am thinking this is referring to the image URL, not the saved image
i first thought something was wrong with the way i setup media root or media url until i went to admin and uploaded an image manually and i saw everything is working fine.
here is save method
def save(self, force_insert=False, force_update=False, commit=True):
image = super().save(commit=False)
image_url = self.cleaned_data["url"]
name = slugify(image.title)
extension = image_url.rsplit(".", 1)[1].lower()
image_name = f"{name}.{extension}"
# download image from the given URL
response = request.urlopen(image_url)
image.image.save(image_name, ContentFile(response.read()), save=False)
if commit:
image.save()
return image```
The text was updated successfully, but these errors were encountered:
I have tried all possibilities with this process here I have my form below, everything works fine but after I clock on upload I get redirected to the detail page with the image displaying, so am thinking this is referring to the image URL, not the saved image
i first thought something was wrong with the way i setup media root or media url until i went to admin and uploaded an image manually and i saw everything is working fine.
here is save method
The text was updated successfully, but these errors were encountered: