add processing images in the using django

Xristos Xristoou saxri89 at
Thu Mar 30 11:07:31 EDT 2017

want to create a simple image processing using Django. my tasks is easy I have some user a simple model and that user can upload images in my project using html form or django form and then that images saves to upload_to='mypath' in upload from my model. but I have some questions :
I have a simple image processing in my if the processing complete success then create new image and I want that image to add in the upload from my model .
how to do that in Django ?
class MyModel(models.Model):
    user = models.ForeignKey(User)
    upload = models.ImageField(upload_to='mypath/personal/folder/per/user')
def index(request):
    form = ImageUploadForm(request.POST or None, request.FILES or None)
    if request.method == "POST" and form.is_valid():
        image_file = request.FILES['image'].read()
        image processing new image

        return render_to_response("blog/success.html", {"new image":new image})
    return render_to_response('blog/images.html', {'form': form}, RequestContext(request))

More information about the Python-list mailing list