199 Commits

Author SHA1 Message Date
Gareth Lloyd
4abfcb0188 check for presence of _geo_indices on field class before referencing 2011-08-15 10:01:48 +01:00
Ross Lawley
3f3f93b0fa Fixing delta bug for dict fields 2011-07-29 15:48:29 +01:00
Ross Lawley
e3cbeb9df0 Merge pull request #243 from wpjunior/sequencefield_fixes
Sequencefield fixes
2011-07-22 06:34:43 -07:00
Wilson Júnior
130fb9916d fixes for SequenceField 2011-07-22 10:19:41 -03:00
Ross Lawley
ac72722e57 Fixing bug setting a value that equates to false 2011-07-22 13:51:11 +01:00
Wilson Júnior
382b9a61a8 Merge branch 'dev' of git://github.com/hmarr/mongoengine into db_field_maps_tweaks 2011-07-22 09:25:59 -03:00
Ross Lawley
72aa191e70 Stop abstract classes being used in the document_registry 2011-07-20 11:58:13 +01:00
Ross Lawley
0d1804461d Updated handling setting of object managers and inheritance 2011-07-19 22:12:09 +01:00
Wilson Júnior
273412fda1 tweaks for _db_field_map 2011-07-19 14:48:38 -03:00
Wilson Júnior
49764b51dc tweaks for _db_field_map 2011-07-19 14:43:32 -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
cb324595ef fixerrors 2011-07-19 07:36:35 -03:00
Ross Lawley
72995a4b3e Fixed changing default values to False for embedded items 2011-07-13 16:06:40 +01:00
Ross Lawley
cace665858 _delta checking didn't handle db_field_names at all
Fixed and added tests, thanks to @wpjunior and @iapain for initial test cases
[fixes #226]
2011-07-12 10:20:36 +01:00
Ross Lawley
0fb629e24c Added cascading deletes
Also ensured that unsetting works when not the default value of a field
2011-07-11 16:01:48 +01:00
Ross Lawley
8e1d701c27 Fixed infinite recursion bug in _geo_indices()
Fixes #213  Thanks to joshink for the bug report
2011-06-30 10:32:05 +01:00
Ross Lawley
87f486c4f1 Added select_related() and refactored dereferencing
Added a dereference class to handle both select_related
 / recursive dereferencing and fetching dereference.

Refs #206
2011-06-27 12:25:49 +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
e3cd398f70 Changed default collection naming
Also added upgrade text
2011-06-20 14:00:06 +01:00
Ross Lawley
f41c5217c6 Added a cleaner way to get collection names
Also handles dynamic collection naming - refs #180.
2011-06-20 11:48:12 +01:00
Ross Lawley
1b0323bc22 Added document mixin support
For extendable / reusable documents
Fixes #204
2011-06-20 09:44:53 +01:00
Ross Lawley
cae3f3eeff Fixes pickling issue with choice fields
Removes the dynamic __get_field_display partials before pickling
2011-06-16 12:50:45 +01:00
Ross Lawley
22a7ee5885 Handle old named (referenced) docs
Refs #199
2011-06-16 09:56:54 +01:00
Ross Lawley
658b85d327 Inconsistent setting of '_cls' broke inherited document referencing
Fixes #199
2011-06-15 16:51:49 +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
0338ac17b1 Fixes multiple assignment issue preventing saves
Thanks to @wpjunior for the ticket and testcase
Also fixed bug in BaseList
fixes #195
2011-06-15 08:57:46 +01:00
Ross Lawley
cb1dfdfac6 Fixes to signals
The sender is the class of the document not the instance - easier to
hook into
2011-06-14 16:56:04 +01:00
Ross Lawley
4c2b83d9ca Remove errant __delete__ method 2011-06-14 15:00:26 +01:00
Ross Lawley
7cb24446ec Merge remote branch 'origin/dev' into dev 2011-06-14 14:36:30 +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
e518c51de3 Merge pull request #193 from colinhowe/dev
Improved Validation warnings - Thanks Colin Howe
2011-06-13 12:52:31 -07:00
Ross Lawley
ea35fb1c54 More robust _present_fields additions 2011-06-13 12:49:09 +01:00
Colin Howe
82fbe7128f Improve validation warnings 2011-06-10 17:31:42 +01:00
Ross Lawley
fd7f882011 Save no longer tramples over documents now sets or unsets explicit fields.
Fixes #146, refs #18
Thanks @zhangcheng for the initial code
2011-06-09 16:09:06 +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
602d7dad00 Improvements to Abstract Base Classes
Added test example highlighting what to do to migrate a class from
complex (allows inheritance) to simple.
2011-06-08 17:10:26 +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
7e87ed79ab Merge branch 'feature/blinker_signals' into dev 2011-06-06 11:10:12 +01:00
Ross Lawley
ec7effa0ef Added DereferenceBaseField class
Handles the lazy dereferencing of all items in a list / dict.
Improves query efficiency by an order of magnitude.
2011-06-06 11:04:06 +01:00
Ross Lawley
5d778648e6 Inital tests for dereferencing improvements 2011-05-27 11:33:40 +01:00
Ross Lawley
c3a8840435 Blinker signals added 2011-05-24 20:27:19 +01:00
Ross Lawley
088c40f9f2 Added Abstract Base Classes
Thanks to @theojulienne for the code :) #108
2011-05-24 12:30:12 +01:00
Ross Lawley
1126c85903 Added Custom Objects Managers
Managers can now be directly declared in a Document eg::

```python
    class CustomQuerySetManager(QuerySetManager):

        @staticmethod
        def get_queryset(doc_cls, queryset):
            return queryset(is_published=True)

    class Post(Document):
        is_published = BooleanField(default=False)
        published = CustomQuerySetManager()
```

Refactored the name of the `_manager_func` to `get_queryset` to mark it as
part the public API.  If declaring a Manager with a get_queryset method, it
should be a staticmethod, that accepts the document_class and the queryset.

Note - you can still use decorators in fact in the example below,
we effectively do the same thing as the first example and is much less verbose.

```python

    class Post(Document):
        is_published = BooleanField(default=False)

        @queryset_manager
        def published(doc_cls, queryset):
            return queryset(is_published=True)
```

Thanks to @theojulienne for the initial impetus and code sample #108
2011-05-24 11:26:46 +01:00
Ross Lawley
1b72ea9cc1 Fixed detection of unique=True in embedded documents.
Added some more test cases - thanks to @heyman for the initial
test case.

Closes #172
Refs #171
2011-05-20 16:09:03 +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
98436f271e Merge branch 'master' into dev 2011-05-18 08:13:58 +01:00
Анхбаяр Лхагвадорж
96dbeea171 Added __hash__, __ne__ with test. 2011-04-12 20:23:16 +08:00
Harry Marr
d7c9694be0 Merge branch 'master' of https://github.com/radev/mongoengine into dev 2011-03-06 13:23:30 +00:00
Harry Marr
ce8b3ea0a1 Merge remote branch 'nvie/dev' into dev 2011-01-09 23:29:11 +00:00
Vincent Driessen
07ef58c1a7 Rename delete_rule -> reverse_delete_rule. 2010-12-20 05:55:46 -08:00