Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:59:48+00:00 2026-06-15T18:59:48+00:00

I have following class definition in mongoengine orm: import mongoengine as me class Description(me.Document):

  • 0

I have following class definition in mongoengine orm:

import mongoengine as me

class Description(me.Document):
    user = me.ReferenceField(User, required=True)
    name = me.StringField(required=True, max_length=50)
    caption = me.StringField(required=True, max_length=80)
    description = me.StringField(required=True, max_length=100)
    image = me.ImageField()

in my post method of my tornado web requesthandler:

from PIL import Image

def post(self, *args, **kwargs):
    merchant = self._merchant
    data = self._data
    obj_data = {}
    if merchant:
        params = self.serialize() # I am getting params dict. NO Issues with this.
        obj_data['name'] = params.get('title', None)
        obj_data['description'] = params.get('description', None)
        path = params.get('file_path', None)
        image = Image.open(path)
        print image # **
        obj_data['image'] = image # this is also working fine.
        obj_data['caption'] = params.get('caption', None)
        obj_data['user'] = user
        des = Description(**obj_data)
        des.save()

        print obj_data['image'] # **
        print des.image # This is printing as <ImageGridFsProxy: None>

** print obj_data[‘image’] and print image are printing following:

<PIL.PngImagePlugin.PngImageFile image mode=1 size=290x290 at 0x7F83AE0E91B8>

but

des.image still remains None.

Please suggest me what is wrong here.

Thanks in advance to all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:59:49+00:00Added an answer on June 15, 2026 at 6:59 pm

    You can not just put PIL objects into a field with obj.image = image that way. You must do:

    des = Description()
    des.image.put(open(params.get('file_path', None)))
    des.save()
    

    In other words, ImageField should be filled with file object after creating an instance by calling put method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class definition. Contact.h #import <CoreData/CoreData.h> @interface Contact : NSManagedObject {
I have the following class definition: template<typename QueueItemT> class QueueBC { protected: QueueBC() {}
I have the following class definition: public interface IItem{} public class FirstObject<T, U> :
I have the following simple class definition: //mycommon.h @interface CurrentPath : NSObject @property (nonatomic,
I have the following property definition: public static class Extensions { public static readonly
I have a the following method definition in my class: virtual Calc* Compile( Evaluator*
I have a function definition of the following form (within a large code): class
I have the following class definition and the main(). Can someone please point me
Let's say I have the following class definition : List<SomeClass>... public class SomeClass {
I'm developing a shared library. Let's say I have the following class definition: class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.