Fixed GridFSProxy __getattr__ behaviour (#196)
This commit is contained in:
@@ -22,6 +22,7 @@ Changes in 0.8.X
|
||||
- Only allow QNode instances to be passed as query objects (#199)
|
||||
- Dynamic fields are now validated on save (#153) (#154)
|
||||
- Added support for multiple slices and made slicing chainable. (#170) (#190) (#191)
|
||||
- Fixed GridFSProxy __getattr__ behaviour (#196)
|
||||
|
||||
Changes in 0.7.9
|
||||
================
|
||||
|
||||
@@ -18,20 +18,10 @@ a document is created to store details about animals, including a photo::
|
||||
family = StringField()
|
||||
photo = FileField()
|
||||
|
||||
marmot = Animal('Marmota', 'Sciuridae')
|
||||
|
||||
marmot_photo = open('marmot.jpg', 'r') # Retrieve a photo from disk
|
||||
marmot.photo = marmot_photo # Store photo in the document
|
||||
marmot.photo.content_type = 'image/jpeg' # Store metadata
|
||||
|
||||
marmot.save()
|
||||
|
||||
Another way of writing to a :class:`~mongoengine.FileField` is to use the
|
||||
:func:`put` method. This allows for metadata to be stored in the same call as
|
||||
the file::
|
||||
|
||||
marmot.photo.put(marmot_photo, content_type='image/jpeg')
|
||||
marmot = Animal(genus='Marmota', family='Sciuridae')
|
||||
|
||||
marmot_photo = open('marmot.jpg', 'r')
|
||||
marmot.photo.put(marmot_photo, content_type = 'image/jpeg')
|
||||
marmot.save()
|
||||
|
||||
Retrieval
|
||||
|
||||
Reference in New Issue
Block a user