Commit Graph
39 Commits
Author SHA1 Message Date
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
Florian Schlachter 95efa39b52 Added *.egg to .gitignore. 2010-08-30 14:56:18 +02:00
Florian Schlachter c27ccc91d2 Merge remote branch 'hmarr/v0.4'
Conflicts:
	tests/fields.py
2010-08-30 14:55:49 +02:00
Florian Schlachter 1e1d7073c8 Merge remote branch 'hmarr/v0.4'
Conflicts:
	tests/fields.py
2010-08-30 14:33:04 +02:00
flosch 21d267cb11 Now order_by() works like queries for referencing deeper fields (replacing . with __). old: order_by('mydoc.myattr') / new: order_by('mydoc__myattr'). Closes #45 2010-07-26 17:28:59 +02:00
flosch 6791f205af Style fix. 2010-07-26 16:50:09 +02:00
flosch 7ab2e21c10 Handle unsafe expressions when using startswith/endswith/contains with unsafe expressions. Closes #58 2010-07-26 16:42:10 +02:00
flosch 2f991ac6f1 Added all() method to get all document instances from a document. Extended the FileField's tests with testing on empty filefield. 2010-07-25 19:02:15 +02:00
flosch 9411b38508 Removed unnecessary comment. 2010-07-25 18:45:49 +02:00
flosch 386c48b116 Typo. 2010-07-25 18:43:11 +02:00
flosch 9d82911f63 Added tests for #46. 2010-07-25 18:38:24 +02:00
flosch 51065e7a4d Closes #46 by instantiating a new default instance for every field by request. 2010-07-25 18:33:33 +02:00
flosch 327452622e Handle DBRefs correctly within Q objects. Closes #55 2010-07-25 18:22:26 +02:00
flosch 13316e5380 Introduced new Document.objects.create, like django has. It creates a new object, saves it and returns the new object instance. 2010-07-25 17:35:09 +02:00
Florian Schlachter 11c7a15067 Added test for DictField's basecls. 2010-05-14 13:49:13 +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 682326c130 documentation bug fixed 2010-04-30 18:04:58 +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
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
Florian Schlachter 0a074e52e0 Merge remote branch 'hmarr/master'
Conflicts:
	mongoengine/fields.py
2010-04-15 23:10:34 +02: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
Florian Schlachter a93509c9b3 Merge remote branch 'hmarr/master' 2010-02-12 10:19:47 +01:00
Florian Schlachter 1114572b47 Merge remote branch 'hmarr/master' 2010-02-10 14:25:33 +01:00
Florian Schlachter e2414d8fea Merge remote branch 'hmarr/master' 2010-02-05 00:36:26 +01:00
Florian Schlachter 24db0d1499 return db-object to allow low-level access from outside via connect() 2010-02-05 00:35:49 +01:00
Florian Schlachter df5b1f3806 Merge remote branch 'hmarr/master' 2010-02-03 02:26:26 +01:00
Florian Schlachter 59f8c9f38e make mongoengine more international :) using unicode-strings; str(err) raises errors if it contains non-ascii chars/umlauts 2010-02-02 21:48:47 +01:00
Florian Schlachter 69e9b5d55e fixed unicode-bug; replaced str(err) with err.message 2010-02-02 21:44:11 +01:00
Florian Schlachter a2d8b0ffbe Merge remote branch 'hmarr/master' 2010-02-02 18:49:52 +01:00