Commit Graph

112 Commits

Author SHA1 Message Date
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
Deepak Thukral
df8f4e7251 no message in expection in future version of python 2010-03-11 20:42:27 +01:00
Harry Marr
95a7b33fb4 Changed how GenericReferenceFields are stored / queried 2010-02-28 23:15:21 +00:00
Harry Marr
81dd5adccf GenericReferenceField docs 2010-02-28 21:30:54 +00:00
blackbrrr
03d31b1890 added global model registry and GenericReferenceField, a ReferenceField not bound to a particular model 2010-02-26 16:59:12 -06:00
Deepak Thukral
90d9bd9723 added natural object comparision 2010-02-21 12:13:58 +01:00
blackbrrr
348f7b5dfc merged master, fixed 1 merge conflict 2010-02-14 17:23:38 -06:00
Harry Marr
ea1fe6a538 Fixed set/unset issue with ListFields 2010-02-12 11:21:51 +00:00
blackbrrr
c4513f0286 merged master 2010-02-11 15:43:37 -06:00
Florian Schlachter
73aff806f3 reset to master, keep working on the dirty-fields-patch in another branch 2010-01-31 18:00:01 +01:00
Florian Schlachter
963a223e7e Merge remote branch 'hmarr/master'
Conflicts:
	mongoengine/queryset.py
2010-01-31 17:43:56 +01:00
Florian Schlachter
431f006751 new save() method updates only dirty fields. fixes issue #18 2010-01-31 14:40:00 +01:00
Harry Marr
ffc9d7b152 Merge branch 'master' of git://github.com/flosch/mongoengine
Added unit test for get_or_create, merged flosch's get with
punteney's get.

Conflicts:
	mongoengine/queryset.py
2010-01-31 13:24:50 +00:00
Florian Schlachter
7d6e117f68 added get-method to fetch exactly one document from the collection. catching pymongo's ObjectId-errors and raising mongoengine's ValidationError instead. 2010-01-31 01:11:37 +01:00
Harry Marr
bca6119db8 Minor tidyup 2010-01-26 19:36:19 +00:00
Harry Marr
568000805f EmbeddedDocuments may now be non-polymorphic 2010-01-25 01:00:04 +00:00
blackbrrr
f1e51f9708 Merge branch 'master' of git://github.com/hmarr/mongoengine into deferred_fields 2010-01-19 12:27:14 -06:00
Harry Marr
3357b55fbf Indexing on ListFields now works properly 2010-01-16 15:35:01 +00:00
blackbrrr
b0b8e11c60 Merge branch 'master' into deferred_fields 2010-01-14 11:39:09 -06:00
blackbrrr
7e0fcb9e65 groundwork for deferred fields 2010-01-14 11:39:03 -06:00
blackbrrr
b3c9a76619 Merge branch 'master' of git://github.com/hmarr/mongoengine 2010-01-14 11:32:39 -06:00
blackbrrr
1cdeb8130d ObjectIdField.to_python returns pymongo.objectid.ObjectId 2010-01-14 11:32:01 -06:00
Harry Marr
ce69428cc6 Moved validate() to BaseDocument 2010-01-13 16:41:57 +00:00
blackbrrr
d85ee4e051 fixed merge conflict in BaseField.__init__ 2010-01-12 12:19:30 -06:00
blackbrrr
cfc394963f added queryset chaining via 'filter' method. test included. 2010-01-12 12:16:15 -06:00
Harry Marr
afd416c84e Updated docs, added force_insert to save() 2010-01-11 04:15:36 +00:00
Harry Marr
ec927bdd63 Added support for user-defined primary keys (_ids) 2010-01-10 17:13:56 +00:00
James Punteney
3b37bf4794 Adding __repr__ methods to the queryset and BaseDocument to make it easier to see the results in the console 2010-01-09 10:48:05 -05:00
Harry Marr
4d695a3544 Added single and multifield uniqueness constraints 2010-01-08 12:04:11 +00:00
blackbrrr
9195d96705 added default ordering to meta options, included docs and tests 2010-01-07 23:08:33 -06:00
blackbrrr
2a7fc03e79 fixed merge conflict in queryset.py, used hmarr's code 2010-01-07 20:23:11 -06:00
blackbrrr
a6d64b2010 added meta support for indexes ensured at call-time 2010-01-07 23:28:10 +08:00
Harry Marr
2e74c93878 Minor bugfixes 2010-01-07 15:24:52 +00:00
Harry Marr
557fb19d13 Query values may be processed before being used 2010-01-06 03:14:21 +00:00
blackbrrr
ccb4827ec9 added meta support for indexes ensured at call-time 2010-01-05 14:28:24 -06:00
Harry Marr
4ae21a671d Document dict access now only looks for fields 2010-01-05 19:37:30 +00:00
blackbrrr
bb4444f54d Merge branch 'master' of git://github.com/hmarr/mongoengine 2010-01-05 12:00:07 -06:00
Harry Marr
6363b6290b Added capped collections support 2010-01-04 03:33:42 +00:00