[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    add processing images in the model.py using django
From:       Xristos Xristoou <saxri89 () gmail ! com>
Date:       2017-03-30 15:07:31
Message-ID: 489dcfdd-398a-4517-9819-3639794451a2 () googlegroups ! com
[Download RAW message or body]

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 views.py 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 ?
models.py
class MyModel(models.Model):
    user = models.ForeignKey(User)
    upload = models.ImageField(upload_to='mypath/personal/folder/per/user')
views.py
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))
-- 
https://mail.python.org/mailman/listinfo/python-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic