701 Commits

Author SHA1 Message Date
Steve Challis
0ad343484f Added new FileField with GridFS support
The API is similar to that of PyMongo and most of the same operations are
possible.

The FileField can be written too with put(), write() or by using the assignment
operator. All three cases are demonstrated in the tests. Metadata can be added
to a FileField by assigning keyword arguments when using put() or new_file().
2010-06-02 20:53:39 +01:00
Harry Marr
196606438c Fixed Q-object list query issue 2010-05-30 18:34:06 +01:00
Flavio Amieiro
a2c78c9063 Add 'exact' and 'iexact' match operators for QuerySets 2010-05-26 20:24:57 -03:00
Harry Marr
b23353e376 Fixed inherited document primary key issue 2010-05-24 23:03:30 +01:00
Stephan Jaekel
f657432be3 always ignore empty Q objects, if the new Q is empty, the old one will be returned. 2010-05-14 14:35:27 +02:00
Stephan Jaekel
225972e151 Added some handy shortcuts for django users. 2010-05-14 14:03:18 +02:00
Stephan Jaekel
4972bdb383 ignore empty Q objects when combining Q objects. 2010-05-14 14:02:39 +02:00
Florian Schlachter
9df725165b Added a possibility to define a base class for fields from a DictField (instead of using BaseField). This is important if you want to use field-based query abilities like StringField's startswith/endswith/contains. Just define `basecls´ when defining your DictField. Example:
class Test(Document):

    name = StringField()
    translations = DictField(basecls=StringField)

Without basecls defined:

> Test.objects(translations__german__startswith='Deutsch')
[]

With basecls set to StringField:

> Test.objects(translations__german__startswith='Deutsch')
[<Test: Test object>]
2010-05-14 13:35:45 +02: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
Harry Marr
edfda6ad5b BinaryField returns str not unicode 2010-04-17 21:24:06 +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
170c56bcb9 introduced min_length for a StringField 2010-04-16 18:13:11 +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
Florian Schlachter
0a074e52e0 Merge remote branch 'hmarr/master'
Conflicts:
	mongoengine/fields.py
2010-04-15 23:10:34 +02:00
Harry Marr
2b08ca7c99 Merge branch 'SortedListField' of git://github.com/joshourisman/mongoengine 2010-04-12 17:41:09 +01:00
Josh Ourisman
c8e466a160 Moved SortedListField stuff into its own branch 2010-04-12 12:31:52 -04:00
Timothée Peignier
a39685d98c make get_or_create returns a tuple with the retrieved or created object and a boolean specifying whether a new object was created 2010-04-12 16:21:29 +01:00
Harry Marr
90200dbe9c Fixed DecimalField bug 2010-04-12 15:59:20 +01:00
Florian Schlachter
2304dac8e3 added GeoLocationField with auto index-creation for GEO2D 2010-03-30 00:04:39 +02:00
Florian Schlachter
38b2919c0d added emailfield 2010-03-29 22:02:33 +02:00
Deepak Thukral
207fd9fcb7 keeping import policy in mind 2010-03-29 11:27:50 +02:00
Deepak Thukral
fbcf58c48f updated documentation 2010-03-29 11:25:17 +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
00c8d7e6f5 Bump to v0.3 2010-03-17 16:50:13 +00:00
Harry Marr
0d89e967f2 Merge branch 'mapreduce' of git://github.com/blackbrrr/mongoengine 2010-03-17 16:44:24 +00:00
blackbrrr
447f8d0113 MapReduceDocument.object works with custom primary keys. test included. 2010-03-17 11:31:17 -05:00
Harry Marr
60802796cb Made ListField validation exceptions more helpful 2010-03-17 15:10:10 +00:00
Harry Marr
5b42578cb1 Added ~ field name substitution to mapreduce funcs 2010-03-17 14:06:31 +00:00
Harry Marr
25a0a5364a Deprecated 'name' arg for fields in favour of 'db_field' 2010-03-17 13:47:23 +00:00
Harry Marr
047cc218a6 Merge branch 'mapreduce' of git://github.com/blackbrrr/mongoengine
Conflicts:
	mongoengine/queryset.py
2010-03-17 12:31:08 +00:00
Harry Marr
39fc862676 Merge branch 'upsert' of git://github.com/blackbrrr/mongoengine 2010-03-17 12:30:18 +00:00
blackbrrr
f156da4ec2 bumped version 2010-03-17 00:50:44 -05:00
blackbrrr
0b62c9d2f6 Merge branch 'master' of git://github.com/hmarr/mongoengine 2010-03-17 00:34:00 -05: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
blackbrrr
acda64a837 fixed field_js merge artifact 2010-03-09 15:31:28 -06:00
blackbrrr
49a001a93a re-added missing QuerySet._ordering 2010-03-09 15:28:55 -06:00
blackbrrr
22a6ec7794 merged conflicts 2010-03-09 15:19:14 -06:00
blackbrrr
26c6e4997c added 'upsert' arg to QuerySet.update and QuerySet.update_one 2010-03-08 21:59:54 -06:00
Harry Marr
92150e07d3 Merge branch 'binary-fields' of git://github.com/benmur/mongoengine 2010-03-08 22:17:21 +00:00
Harry Marr
ac3c857e1a Added rewind to QuerySet, which is implicitly called when iteration finishes 2010-03-08 22:15:40 +00:00
Rached Ben Mustapha
0b3af2052f implement binary field size validation 2010-03-08 17:06:52 +01:00