114 Commits

Author SHA1 Message Date
Ross Lawley
97114b5948 Fix for FileField losing ref without default
fixes hmarr/mongoengine#458
2012-05-09 20:50:11 +01:00
Ross Lawley
2aa8b04c21 Implemented Choices for GenericReferenceFields
Refs mongoengine/mongoengine#13
2012-05-09 13:21:53 +01:00
Ross Lawley
aeebdfec51 Implemented Choices for GenericEmbeddedDocuments
Refs mongoengine/mongoengine#13
2012-05-09 12:58:45 +01:00
David Ignacio
e07ecc5cf8 Cleanup referenced GridFS files when a document is deleted
Note that drop_collection is not modified since there is no
guarantee that a GridFS collection holds files for only one
Document class.  Otherwise you could drop files for other fields
or documents accidentally.
2012-05-05 01:33:08 -04:00
Ross Lawley
0240a09056 Cleaned up ValidationError Refs #459 2012-05-01 10:14:16 +01:00
Jona Andersen
c474ca0f13 Allow File-like objects to be stored.
No longer demands FileField be an actual instance of file, but instead
checks whether object has a 'read' attribute. Fixes read() on
GridFSProxy to return an empty string on read failure, or None if file
does not exist.
2012-04-22 13:49:18 +02:00
Chris Faulkner
50d9b0b796 Add dict.update() support to BaseDict. 2012-01-16 19:13:03 +08:00
Ross Lawley
0187a0e113 Handle updating and getting None values
Fixes updating a field to None, so it works in a similar
fashion as unsetting it via save()

Updated to handle null data from the database

Fixes #362
2011-11-30 08:12:44 -08:00
Ross Lawley
6cef571bfb Added Reverse option to SortedLists
Thanks Stephen Young for the patch
closes #364
2011-11-30 02:15:47 -08:00
Ross Lawley
083f00be84 Fixes passed in Constructor data for complexfields
Fixes #355
2011-11-28 08:09:17 -08:00
Ross Lawley
208a467b24 Added dictfield check for Int keys
Fixes #371
2011-11-28 07:05:54 -08:00
Wilson Júnior
fa4b820931 added support for db_alias in FileFields 2011-11-22 13:40:01 -02:00
Ross Lawley
e80144e9f2 Added multidb support
No change required to upgrade to multiple databases. Aliases are used
to describe the database and these can be manually registered or fall
through to a default alias using connect.

Made get_connection and get_db first class members of the connection class.
Old style _get_connection and _get_db still supported.

Refs: #84 #87 #93 #215
2011-11-22 08:01:14 -08:00
Ross Lawley
4e44198bbd Clean up of choices code and added tests
[#284] [#314]
2011-11-04 01:45:44 -07:00
Ross Lawley
3ee60affa9 Renamed schema for errors
Now is `to_dict()` as is more explicit
[refs #344 #328]
2011-11-01 01:51:58 -07:00
Ross Lawley
558b8123b5 Merge branch 'validation-schema' of https://github.com/n1k0/mongoengine into validation-schema
Conflicts:
	mongoengine/base.py
	mongoengine/fields.py
2011-11-01 01:45:32 -07:00
Ross Lawley
56d1139d71 Added ImageField Support
Thanks to @wpjunior for the patch
Closes [#298]
2011-10-27 00:58:47 -07:00
Nicolas Perriault
62480fe940 added a ValidatorError.schema properties which contains a dict representation of the whole validation error schema 2011-10-24 17:15:34 +02:00
Nicolas Perriault
3d7b30da77 first version of BC validation schema 2011-10-24 01:02:31 +02:00
Wilson Júnior
8e87648d53 added tests for get_or_create 2011-10-19 09:44:49 -02:00
Wilson Júnior
7f2b686ab5 added drop_collection for test 2011-10-19 06:55:05 -02:00
Wilson Júnior
b09c52fc7e fixes for #325 issue 2011-10-19 06:30:41 -02:00
Pau Aliagas
d59862ae6e Merge remote-tracking branch 'upstream/dev' into integration/uuid 2011-10-04 16:02:58 +02:00
Pau Aliagas
0a03f9a31a Add unit tests for UUIDField 2011-10-04 15:59:56 +02:00
Ross Lawley
6961a9494f Updates to ComplexFields
Required now means they cannot be empty [#302]
2011-10-04 04:26:56 -07:00
Ross Lawley
17728d4e74 Added tests for empty lists 2011-10-04 02:57:50 -07:00
Ross Lawley
60b6ad3fcf Added test for listfield fix
Added Pau Aliagas to authors
[closes #299]
2011-10-03 05:30:23 -07:00
Ross Lawley
2bc3948726 Merge remote branch 'wpjunior/genericembeddedfield' into genericembeddedfield 2011-09-09 06:07:07 -07:00
Ross Lawley
1631788ab6 Now Raise an exception if subclasses are missing at querytime.
Beats returning None thanks to #aid for mentioning it on IRC
2011-08-24 13:37:39 +01:00
Wilson Júnior
6471c6e133 added GenericEmbeddedDocumentField 2011-07-27 08:45:15 -03:00
Wilson Júnior
130fb9916d fixes for SequenceField 2011-07-22 10:19:41 -03:00
Ross Lawley
5834fa840c Tweaked SequenceField so that it doesn't increment on creation.
[refs #238]
2011-07-19 16:51:26 +01:00
Wilson Júnior
fa39789bac added SequenceField 2011-07-18 12:44:28 -03:00
Ross Lawley
dc5a613bc7 Fixes conversion of null genericreferences in querysets
closes #211
2011-07-11 09:19:27 +01:00
Zak Johnson
3d15a3b3e2 Add GridFSProxy.__nonzero__
For documents that do not have a value set for a given field, most field types
return None (or [] in the case of ListField). This makes it easy to test
whether a field has been set using "if doc.field". FileFields, on the other
hand, always return a GridFSProxy. Adding GridFSProxy.__nonzero__ which simply
checks for a grid_id allows the same boolean-test pattern for FileFields, as
well.
2011-06-29 20:48:39 -07:00
Ross Lawley
09c32a63ce Fixes bug with appending post save - due to lists not being reset 2011-06-21 12:34:14 +01:00
Ross Lawley
08ba51f714 Updated geo_index checking to be recursive
Fixes #127 - Embedded Documents can declare geo indexes and have
them created automatically
2011-06-20 15:41:23 +01:00
Ross Lawley
5cc9188c5b Improved validation of (Generic)Reference fields 2011-06-16 15:25:09 +01:00
Ross Lawley
ffb3e8b7b9 Added help_text and verbose_name to fields
closes #192
2011-06-15 11:28:41 +01:00
Ross Lawley
576db9ca88 Fixes DateTimeField handling of date objects.
Fixes #191
2011-06-14 15:09:03 +01:00
Ross Lawley
0ed79a839d Added delta tracking to documents.
All saves on exisiting items do set / unset operations only on changed fields.
* Note lists and dicts generally do set operations for things like pop() del[key]
  As there is no easy map to unset and explicitly matches the new list / dict

fixes #18
2011-06-14 14:35:38 +01:00
Ross Lawley
b2848b8519 Added ComplexDateTimeField
Thanks to @pelletier for the code.
Refs #187
2011-06-09 14:20:21 +01:00
Ross Lawley
a66417e9d0 pep8 update 2011-06-09 11:31:47 +01:00
Ross Lawley
4b9bacf731 Added ComplexBaseField
* Handles the efficient lazy dereferencing of DBrefs.
* Handles complex nested values in ListFields and DictFields
* Allows for both strictly declared ListFields and DictFields where the embedded
value must be of a field type or no restrictions where the values can be a mix
of field types / values.
* Handles DBrefences of documents where allow_inheritance = False.
2011-06-09 11:25:24 +01:00
Ross Lawley
d32dd9ff62 Added _get_FIELD_display() for handy choice field display lookups
closes #188
2011-06-08 13:07:08 +01:00
Ross Lawley
cfcd77b193 Added tests displaying datetime behaviour.
Updated datetimefield documentation
2011-06-08 10:33:56 +01:00
Ross Lawley
7ecf84395a Improved DictFields
Allow searching multiple levels deep in DictFields
Allow DictField entries containing strings to use matching operators

Thanks again to @theojulien for the initial code #108
2011-05-24 14:07:58 +01:00
Ross Lawley
32bab13a8a Added MapField, similar to DictField
Similar to DictField except the value of each entry is always of a certain
(declared) field type.

Thanks again to @theojulienne for the code #108
2011-05-24 12:50:48 +01:00
Ross Lawley
9260ff9e83 Updated docs and added a NotRegistered exception
For handling GenericReferences that reference documents that haven't
been imported.

Closes #170
2011-05-20 10:22:22 +01:00
Ross Lawley
efba9ef52a Merge remote branch 'srackham/gridfs-read-seek' into gridfs-read-seek 2011-05-19 10:14:51 +01:00