199 Commits

Author SHA1 Message Date
Vincent Driessen
16e1f72e65 Avoid confusing semantics when comparing delete rules. 2010-12-14 03:39:14 -08:00
Vincent Driessen
620f4a222e Don't check for DO_NOTHING in the delete rule registration method.
It is already checked before it is invoked.  This saves the ugly import
of DO_NOTHING inside document.py.
2010-12-14 02:03:26 -08:00
Igor Ivanov
a68cb20266 Allow 0 or "" to be used as valid _id value. 2010-12-09 08:38:47 -08:00
Vincent Driessen
bba3aeb4fa Actually *use* the register_delete_rule classmethod, since it's there. 2010-12-05 22:24:27 -08:00
Vincent Driessen
86233bcdf5 Added initial implementation of cascading document deletion.
The current implementation is still very basic and needs some polish.
The essence of it is that each Document gets a new meta attribute called
"delete_rules" that is a dictionary containing (documentclass,
fieldname) as key and the actual delete rule as a value.  (Possible
values are DO_NOTHING, NULLIFY, CASCADE and DENY.  Of those, only
CASCADE is currently implented.)
2010-12-05 22:24:27 -08:00
Vincent Driessen
67fcdca6d4 Fix: PyFlakes pointed out this missing import. 2010-12-05 22:24:27 -08:00
Viktor Kerkez
e1282028a5 Added django style choices 2010-11-01 14:54:55 +01:00
Viktor Kerkez
ef15733efe Added creation_counter to BaseField in order to provied form modules with a way to sort fields i order user specified them (same technique is used in Django) 2010-10-23 22:35:37 +02:00
Viktor Kerkez
f0c5dd1bce Small fix for Python 2.5 2010-10-23 22:33:03 +02:00
Harry Marr
e9d478ed9f Merge branch 'master' of http://github.com/cyberdelia/mongoengine into v0.4 2010-10-18 10:22:56 +01:00
Steve Challis
39e27735cc Merge branch 'v0.4' of git://github.com/hmarr/mongoengine into v0.4
Conflicts:
	docs/changelog.rst
	mongoengine/base.py
	mongoengine/queryset.py
2010-10-17 23:48:20 +01:00
Harry Marr
0902b95764 Added support for recursive embedded documents 2010-10-18 00:27:40 +01:00
Harry Marr
3acfd90720 Added some imports for PyMongo 1.9 compatibility. 2010-10-04 14:58:00 +01:00
Timothée Peignier
9c9903664a add support for pk property in documents and filters 2010-10-03 18:50:35 +02:00
Steve Challis
67a9b358a0 Merge branch 'v0.4' of git://github.com/hmarr/mongoengine into v0.4 2010-09-29 23:39:09 +01:00
Steve Challis
b5eb3ea1cd Added a Django storage backend.
- New GridFSStorage storage backend
- New FileDocument document for storing files in GridFS
- Whitespace cleaned up in various files
2010-09-29 23:36:58 +01:00
Harry Marr
f11ee1f9cf Added support for using custom QuerySet classes 2010-09-15 09:47:13 +01:00
Mircea Pasoi
f1aec68f23 Inherit index options. 2010-08-30 17:40:01 +01:00
Mircea Pasoi
dcc8d22cec Proper unique index name when using db_field. 2010-08-30 17:38:07 +01:00
Florian Schlachter
185e7a6a7e Better way of checking if new_class has an 'objects' attribute. 2010-08-30 18:38:41 +02:00
Florian Schlachter
c39f315ddc Merge remote branch 'hmarr/v0.4' 2010-08-30 18:38:12 +02:00
Florian Schlachter
e0911a5fe0 Replaced slow exception handling with has_key. 2010-08-30 14:58:58 +02:00
Harry Marr
2635e41f69 Merge branch 'master' of http://github.com/theojulienne/mongoengine into v0.4 2010-08-30 13:54:07 +01:00
Harry Marr
40eb23a97a Merge branch 'master' of git://github.com/flosch/mongoengine into v0.4
Conflicts:
	tests/fields.py
2010-08-30 13:21:10 +01:00
Harry Marr
f4711699e4 Merge branch 'master' of http://github.com/danielhasselrot/mongoengine into v0.4
Conflicts:
	mongoengine/fields.py
2010-08-30 13:03:23 +01:00
Theo Julienne
b96e27a7e4 Allow documents to override the 'objects' QuerySetManager 2010-07-30 22:09:00 +10:00
flosch
51065e7a4d Closes #46 by instantiating a new default instance for every field by request. 2010-07-25 18:33:33 +02:00
Florian Schlachter
aa00feb6a5 FileField's values are now optional. When no value is applied, no File object is created and referenced. 2010-07-20 22:46:00 +02:00
Florian Schlachter
323c86308a Merge remote branch 'hmarr/v0.4'
Conflicts:
	mongoengine/fields.py
	tests/fields.py
2010-07-19 01:11:28 +02:00
Steve Challis
47bfeec115 Tidied code, added replace() method to FileField 2010-07-19 06:53:21 +08:00
Harry Marr
1c334141ee Merge branch 'geo' of git://github.com/blackbrrr/mongoengine into v0.4
Conflicts:
	mongoengine/fields.py
	mongoengine/queryset.py
2010-07-07 14:53:25 +01:00
Daniel Hasselrot
b89d71bfa5 Do not convert None objects 2010-07-06 14:17:30 +02:00
Daniel Hasselrot
3179c4e4ac Now only removes _id if none, for real 2010-07-06 11:25:49 +02:00
Daniel Hasselrot
f5e39c0064 Allowed _id to be missing when converting to mongo 2010-07-06 10:25:31 +02:00
Harry Marr
b23353e376 Fixed inherited document primary key issue 2010-05-24 23:03:30 +01:00
Florian Schlachter
eecc6188a7 fixes issue #41 since unicode kwargs is an feature of python 2.6.5 and above. 2010-04-19 11:34:09 +02:00
Harry Marr
3b4df4615a Fixed MRO error that occured on document inheritance 2010-04-17 21:45:11 +01:00
Florian Schlachter
3c7e8be2e7 Removed create_default since it can be achieved with the default argument (like default=MyEmbeddedDocument since default takes callables too). 2010-04-17 16:59:09 +02:00
Florian Schlachter
416fcba846 Merge remote branch 'hmarr/master'
Conflicts:
	mongoengine/base.py
2010-04-17 01:42:26 +02:00
Florian Schlachter
e196e229cd Accepting a tuple for validation argument. 2010-04-17 01:36:45 +02:00
Florian Schlachter
da57572409 Introduced new create_default field argument. If set to true, mongoengine will automagically create an instance of the desired document class (useful if using EmbeddedDocumentField for example):
class SubDoc(EmbeddedDocument):
        url = URLField()

    class MyDoc(Document):
        subdoc = EmbeddedDocumentField(SubDoc, create_default=True)

With create_default MyDoc().subdoc is automatically instantiated. Hint: default=SubDoc() WON'T work (that's why I've introduced create_default)
2010-04-17 01:23:14 +02:00
Florian Schlachter
ef172712da bugfix 2010-04-16 22:25:45 +02:00
Florian Schlachter
f3ca9fa4c5 Make validation-lists possible. Example:
class Doc(Document):
        country = StringField(validation=['DE', 'AT', 'CH'])
2010-04-16 18:00:51 +02:00
Florian Schlachter
48facec524 Fixes tiny documentation error. Adds possibility to add custom validation methods to fields, e. g.:
class Customer(Document):
        country = StringField(validation=lambda value: value in ['DE', 'AT', 'CH'])

Replaced some str() with unicode() for i18n reasons.
2010-04-16 16:59:34 +02:00
Don Spaulding
ee0c75a26d Add choices keyword argument to BaseField.__init__() 2010-04-15 17:59:35 -05:00
Deepak Thukral
207fd9fcb7 keeping import policy in mind 2010-03-29 11:27:50 +02:00
Deepak Thukral
8f4a579df9 DoesNotExist and MultipleObjectsReturned now contributes Document class 2010-03-28 22:22:36 +02:00
Matt Dennewitz
a4d2f22fd2 added 'geo_indexes' to TopLevelDocumentMetaclass; added GeoPointField, a glorified [lat float, lng float] container; added geo lookup operators to QuerySet; added initial geo tests 2010-03-23 00:14:01 -05:00
Harry Marr
25a0a5364a Deprecated 'name' arg for fields in favour of 'db_field' 2010-03-17 13:47:23 +00:00
Deepak Thukral
72161a9b71 no message in expection in future version of python 2010-03-11 21:10:04 +01:00