Commit graph

471 commits

Author SHA1 Message Date
Carl Meyer
c5417eb613 Bump version for dev. 2016-04-18 15:08:15 -06:00
Carl Meyer
a43027ccee Bump version to 2.5. 2016-04-18 15:02:40 -06:00
Mike Bryant
ff3f8e5546 Use all the fields to determine _id variants. Fixes #214
If a tracker is defined on an inherited model, where the parent has a ForeignKey,
the tracker will now correctly determine that the field_map takes `fk` -> `fk_id`
2016-03-31 15:45:19 +01:00
Adam Bogdał
4f39ce9497 Add support for Django 1.10 2016-02-09 00:22:12 +01:00
Carl Meyer
f1f8749fa9 Bump version to 2.4.1a1. 2015-12-02 10:55:59 -07:00
Carl Meyer
3c8fe6a7d2 Bump version to 2.4. 2015-12-02 10:43:11 -07:00
Karl WnW
ce8deed5ca Fix _clone signature for Django<1.9
InheritanceQuerySetMixin._clone signature conflicts with django
ValuesQuerySet._clone code which calls super like this:
"c = super(ValuesQuerySet, self)._clone(klass, **kwargs)"
2015-11-02 17:52:43 +01:00
jarekwg
81eba92e61 flakes 2015-10-29 09:37:21 +11:00
jarekwg
1d473ec6a9 Test InheritanceManager fail against a different model 2015-10-29 09:33:45 +11:00
jarekwg
01514db83c Update MutableField for 1.9 2015-10-29 08:12:35 +11:00
jarekwg
201aa3bf30 Half-assed use of User model raises exceptions in 1.9b1 2015-10-29 08:12:02 +11:00
jarekwg
bbad2b7b47 Hide _clone params in kwargs to match django 1.9 signature 2015-10-29 02:00:49 +11:00
jarekwg
2824ec2e48 Remove PassThroughManager
As of Django 1.7, QuerySet.as_manager() achieves the same result.
2015-10-29 00:10:28 +11:00
jarekwg
7a33e14f4b Get StatusFields working 2015-10-29 00:02:46 +11:00
jarekwg
665fc04b7e Must use the 'Now' database function in django>=1.9 2015-10-28 23:47:33 +11:00
Carl Meyer
165e0ec495 Bump version for 2.4 development. 2015-07-20 10:32:18 -06:00
Carl Meyer
443108c7ad Set version for 2.3.1 release. 2015-07-20 10:22:27 -06:00
Carl Meyer
114f4fe228 Add script and makefile tasks for making and compiling messages; un-gitignore .mo files. 2015-07-20 10:20:11 -06:00
Carl Meyer
ab4a2b4ce4 Bump version to 2.4a1. 2015-07-17 13:02:07 -06:00
Carl Meyer
b1c183d475 Bump version to 2.3. 2015-07-17 11:38:39 -06:00
Philipp Steinhardt
1bfee88c06 * clean up po file header 2015-07-02 13:53:39 +02:00
Philipp Steinhardt
5218b483c5 * add german translations 2015-07-01 14:16:40 +02:00
Sergey Zherevchuk
608028aba8 Fix #169 issue
Hardcoding no_excerpt_field field in deconstruct() method of SplitField class
2015-06-18 11:11:28 +03:00
Carl Meyer
d797996d13 Fix Python 2.6 compatibility. 2015-01-28 12:17:34 -07:00
Carl Meyer
a1088dba52 Simpler cross-version implementation of _field_exists. 2015-01-28 10:59:20 -07:00
Carl Meyer
3f9b1cfac8 Fix select_subclasses for Django 1.8. 2015-01-27 16:48:06 -07:00
Carl Meyer
3110794afc Fix 'add_*_manager' signal handlers for Django 1.8+. 2015-01-27 16:43:29 -07:00
ad-m
50caabdd2e Fix #156 issue 2014-10-29 00:27:10 +01:00
Carl Meyer
9786672361 Remove dead code branch. 2014-09-22 12:49:35 -06:00
bboogaard
041ef6b838 Keep track of deferred fields on model instance
Instead of on FieldInstanceTracker instance

Signed-off-by: bboogaard <b.boogaard@auto-interactive.nl>
2014-08-19 10:29:03 +02:00
Carl Meyer
54d915bd4a Bump version to 2.3a1. 2014-07-31 18:57:29 -06:00
Carl Meyer
c62fe9446d Add Changelog entry for revert of GH-130; bump version to 2.2. 2014-07-31 18:16:15 -06:00
Carl Meyer
a127e32217 Revert "Use a signal handler instead of patching save."
This reverts commit 3496fe4291.
2014-07-31 18:08:24 -06:00
Carl Meyer
a0ba93f8c2 Bump version to 2.2a1. 2014-07-25 10:00:46 -06:00
Carl Meyer
24fa8945bb Bump version to 2.1.0. 2014-07-25 09:52:55 -06:00
Keryn Knight
e353a01a9a Implemented ability to change modified fields manually. 2014-07-01 14:38:58 +01:00
Keryn Knight
500dd470cd Tests demonstrating how lying about a modified field ought to be possible. 2014-07-01 14:36:22 +01:00
Matthew Schinckel
8fa34bc609 Add test that may not do anything.
I'm not sure this test is actually useful: it's designed to show the
interaction of select_subclasses and instance_of, but I don't think
it adds much value.
2014-05-22 21:41:16 +09:30
Matthew Schinckel
02e19e45b4 Okay, now we are getting somewhere.
By itself, .instance_of(*models) will actually call select_subclasses(*models),
which results in just those objects being cast to subclasses.

However, if you want the casting to grandchildren (which is supported only in
django 1.6+), then you may use an extra call to .select_subclasses() (without
arguments, to select all subclasses).

It doesn't deal with @kezabelle's discussion of mixed-use of select_subclasses/
instance_of, I still need to look at that.

But it does pass all current tests...
2014-05-22 21:31:31 +09:30
Matthew Schinckel
f54c9a7c95 Remove dead code, add comments. 2014-05-22 21:02:19 +09:30
Matthew Schinckel
4128524eb4 WIP: this fails on django < 1.6
I think this is actually related to the issue related in #23.
2014-05-20 20:58:25 +09:30
Matthew Schinckel
f06b573772 Add tests to show we actually do correctly filter the objects. 2014-05-16 22:49:20 +09:30
Matthew Schinckel
5e8ebef5b1 Add ability to filter an InheritanceQuerySet by model.
This is based upon the feature in django-polymorphic, where you
can do:

    SuperClass.objects.instance_of(SubClass)

This will result in only objects of the subclass being fetched.

Note: this works with any queryset, keeping the filtering and
ordering applied there.
2014-05-16 20:23:04 +09:30
Matthew Schinckel
3496fe4291 Use a signal handler instead of patching save.
References #83.

Instead of patching the save method of a tracked model class, we can use
a signal handler on post_save, which means we can still pickle our model
class.

Note we can't just listen for the signal from the class we have, but
instead listen for all post_save signals. This means we actually install
a new signal handler for each tracked model class, which fires on all
model save occurrences (and returns immediately if this handler doesn't care).

We probably could improve this to have a registry of tracked models, or
something, that allows us to just install one signal handler, and filter
according to membership.
2014-05-12 14:32:59 +09:30
Rodney Folz
2905d1a307 Fix bug where you could only run makemigrations once without error. 2014-04-25 14:17:42 -07:00
Rodney Folz
85a9f8e6b1 Fix "model '%s' must have a %s choices class attribute" error on migrations. 2014-04-25 13:32:49 -07:00
Rodney Folz
db5e1f99fc Fix "MonitorField requires a "monitor" argument" 2014-04-23 19:55:39 -07:00
Rodney Folz
f02b0912b2 Failing test for Django 1.7 makemigrations
======================================================================
ERROR: test_migrate (model_utils.tests.tests.MigrationsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/projects/django-model-utils/model_utils/tests/tests.py", line 42, in test_migrate
    call_command('migrate', fake=True)
  File "/home/user/projects/django-model-utils/.tox/py27-trunk/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 167, in call_command
    return klass.execute(*args, **defaults)
  File "/home/user/projects/django-model-utils/.tox/py27-trunk/local/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute
    output = self.handle(*args, **options)
  File "/home/user/projects/django-model-utils/.tox/py27-trunk/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 138, in handle
    ProjectState.from_apps(apps),
  File "/home/user/projects/django-model-utils/.tox/py27-trunk/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 71, in from_apps
    model_state = ModelState.from_model(model)
  File "/home/user/projects/django-model-utils/.tox/py27-trunk/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 136, in from_model
    e,
TypeError: Couldn't reconstruct field name_changed on tests.Monitored: MonitorField requires a "monitor" argument
2014-04-23 19:10:04 -07:00
Keryn Knight
8a1d0662f1 Provide dir() support for PassThroughManagers.
Reported in #55 by erikcw.
2014-04-15 08:48:01 +01:00
Carl Meyer
61923571b9 Bump version to 2.0.3.post1 for dev. 2014-03-19 22:48:13 -06:00
Carl Meyer
36b7e600c6 Bump version to 2.0.3 for release. 2014-03-19 22:43:48 -06:00
Matthew Schinckel
93500bb381 Ensure we call get_query_set on django 1.5-
Supersedes https://github.com/carljm/django-model-utils/pull/106

I can't actually see why this works, but it does: tests pass
after this that failed before.
2014-03-20 13:11:00 +10:30
Matthew Schinckel
a49936c267 Test case demonstrating relation failure.
https://github.com/carljm/django-model-utils/issues/120
2014-03-20 11:12:38 +10:30
Seán Hayes
3f7378ef60 Allow PassThroughManager subclasses to accept additional params. 2014-03-07 06:32:34 -05:00
Michael van Tellingen
2bcddd5be9 Add fix for Django 1.4 2014-03-01 14:24:25 +01:00
Michael van Tellingen
6ffae1ad8f Add support for deferred fields in the FieldTracker 2014-03-01 13:34:17 +01:00
Michael van Tellingen
1bab9c492d Add failing test 2014-03-01 12:20:13 +01:00
Carl Meyer
f26b33acbc Merge pull request #114 from rsenkbeil/inheritance-manager-self-reference
Fix InheritanceManager when the model has a self reference.
2014-02-19 15:41:01 -07:00
Ryan Senkbeil
617ec2af01 Fix InheritanceManager when the model has a self reference.
Otherwise, we reach max recursion depth.
2014-02-19 15:28:01 -06:00
Carl Meyer
fe0eceaa74 Bump version to 2.0.2.post1. 2014-02-19 14:01:51 -07:00
Carl Meyer
923f131084 Bump version to 2.0.2. 2014-02-19 13:59:49 -07:00
Carl Meyer
6579f5d61f Bump version to 2.0.1.post1. 2014-02-11 15:03:08 -07:00
Carl Meyer
d77608ef76 Bump version to 2.0.1. 2014-02-11 14:58:18 -07:00
Carl Meyer
f19755ae81 Merge pull request #105 from patrys/patch-1
Don't try to access __slots__ during copy()
2014-01-25 16:35:09 -08:00
Carl Meyer
febc3d645a Merge pull request #101 from funkybob/issue-34
Attempt to carry over extras(select) values from parent
2014-01-25 16:25:36 -08:00
Carl Meyer
26f4d7c8f5 Silence BooleanField default warnings. 2014-01-25 17:11:26 -07:00
funkybob
a5fe3de330 Deal with Django <1.7 using SortedDict wherein keys() is a generator, not a view 2014-01-21 09:19:54 +11:00
Patryk Zawadzki
80547335c0 Don't try to access __slots__ during copy()
When subclassing Django will copy managers from the ancestor class. Copying in turn calls `copy.copy()` which checks whether the object uses `__slots__` or `__dict__`. This could result in the manager calling `self.get_queryset()` before all models get registered with the ORM.
2014-01-20 12:50:37 +01:00
funkybob
91b07079e0 Use legacy compatible approach 2014-01-14 15:05:03 +11:00
funkybob
cb362f4a12 Shorten test docstring 2014-01-13 16:49:18 +11:00
Carl Meyer
6512e3e00e Remove trailing whitespace. 2014-01-10 16:29:59 -07:00
Douglas Meehan
33c600e28c edited class names 2014-01-10 16:18:10 -05:00
Douglas Meehan
9e024a14af removed trailing whitespace 2014-01-10 16:15:42 -05:00
Douglas Meehan
aaf1fc8636 changed class names to be more descriptive 2014-01-10 16:06:08 -05:00
Douglas Meehan
55a15f7e55 Update managers.py 2014-01-09 16:58:51 -05:00
Douglas Meehan
72c8f0bc18 moved get_query_set = get_queryset from the mixin to the manager 2014-01-09 21:47:46 +00:00
Curtis Maloney
0e77c327f5 Update tests.py 2014-01-09 15:46:11 +11:00
Douglas Meehan
c787a98f21 removed GeoDjango specific code. Abstracted all managers 2014-01-08 17:19:00 +00:00
Douglas Meehan
e7c3f6b28e edited doc string 2014-01-08 16:57:59 +00:00
Douglas Meehan
a1ffac9fa7 edited class names 2014-01-08 16:56:32 +00:00
Douglas Meehan
a1abc9bb8a edited class names 2014-01-08 16:54:41 +00:00
Douglas Meehan
b529e576ff added geo support for PassThroughManager 2014-01-08 16:46:39 +00:00
Curtis
6f30e88ba5 Attempt to carry over extras(select) values from parent 2014-01-08 23:46:00 +11:00
Carl Meyer
87f7209042 Bump version for dev. 2014-01-06 18:26:01 -07:00
Carl Meyer
6b4a900ca0 Bump version to 2.0. 2014-01-06 18:22:24 -07:00
Carl Meyer
5e39bcd756 Remove special support for pickling PassThroughManager; apparently unnecessary in all supported Django/Python versions. 2014-01-06 18:18:42 -07:00
Carl Meyer
32aa781dc2 Merge branch 'master' into query-set-deprecated
* master:
  Update tox.ini.
  Update runtests.py for compatibility with Django 1.7.
  Check for StatusModel field name conflicts correctly.
2014-01-06 16:06:31 -07:00
Carl Meyer
8ea75e53f4 Check for StatusModel field name conflicts correctly. 2014-01-06 16:03:44 -07:00
Thomas Schreiber
910bcc7830 backwards comptatible get_queryset, for Django < 1.6 2013-12-31 17:30:11 +01:00
Thomas Schreiber
5ae92dba27 fix get_query_set deprecationwarnings 2013-12-30 21:42:52 +01:00
Alejandro Varas
452ac5cd21 Added choices_name parameter to StatusField 2013-11-14 16:12:31 -03:00
Keryn Knight
dd469a0e8f Added test to explicitly demonstrate manually defined related_name
usage works in select_subclasses going forwards.

Also fixed fragility of 2 tests introduced in ae71f9080e
2013-10-26 16:34:21 +01:00
Keryn Knight
a270eef1fd Fixed #59 - manually setting the parent relation
via a OneToOne should present the same behaviour
as the implicit ptr Django generates on
subclasses.

Thanks to Eran Rundstein for reporting the issue
and proposing the fix.
2013-10-26 15:53:15 +01:00
Keryn Knight
262455a60d Update model tests to include our new InheritanceManagerTestChild3
as part of the emulation of select_subclasses.

Test still fails because of #59.
2013-10-26 15:50:19 +01:00
Keryn Knight
ae71f9080e Tests for #59 - a manually specified OneToOne should behave
the same as an implicit one.
2013-10-26 15:44:01 +01:00
Carl Meyer
06d3b7a5cf Tweak line-continuation indentation. 2013-10-22 12:23:16 -06:00
Keryn Knight
1de58474c0 Implemented #44 - passing Model classes to InheritanceManager's select_subclasses 2013-10-21 21:47:58 +01:00
Carl Meyer
3211c92a4d Merge branch 'master' into fix-choices-deepcopy
* master: (23 commits)
  only accepting iterables to the when field
  adding 'when' parameter to MonitorField
  Update AUTHORS and changelog.
  Add test to verify get_subclass() on QuerySet
  Refactor to make sure get_subclass() is on QuerySet
  Fixed indexing into Choices so its useful.
  Fix bug with child/grandchild select_subclasses in Django 1.6+; thanks Keryn Knight.
  fixed code block
  Bump version for dev.
  Bump version for 1.5.0 release.
  Add option-groups capability to Choices.
  Add Changelog note about Choices equality/addition.
  Added tests to improve coverage
  Alphabetised authors
  Removed redundant inequality method on Choices
  Moved documentation for Choices field to the right place
  Corrected typo
  Added self to Authors file
  Added equality methods to Choices objects, and overrode + for Choices for easy concatenation with other Choices and choice-like iterables. Also wrote tests for them, and extended the readme to reflect this
  Fix typo noted by @silonov
  ...

Conflicts:
	model_utils/choices.py
2013-10-11 13:23:56 -06:00
Filipe Ximenes
3d82ec89b4 only accepting iterables to the when field 2013-10-11 08:24:00 -03:00
Filipe Ximenes
e3450977bd adding 'when' parameter to MonitorField 2013-10-11 00:08:38 -03:00
Travis Swicegood
03c8a1929b Add test to verify get_subclass() on QuerySet 2013-10-08 10:38:52 -05:00
Travis Swicegood
9111843752 Refactor to make sure get_subclass() is on QuerySet
There's an edge case where you might want to call get_subclass() on a
QuerySet the same way you can call get() after you have already called
various filter/exclude methods.
2013-10-07 18:15:41 -05:00
Carl Meyer
5a33ff760a Fixed indexing into Choices so its useful. 2013-09-24 15:13:27 -06:00
Carl Meyer
4b6a800050 Fix bug with child/grandchild select_subclasses in Django 1.6+; thanks Keryn Knight. 2013-09-20 10:04:10 -06:00
Carl Meyer
4e7ddfc221 Bump version for dev. 2013-08-29 22:35:32 -06:00
Carl Meyer
edbef99ce2 Bump version for 1.5.0 release. 2013-08-29 22:06:44 -06:00
Carl Meyer
2e44f1c2c0 Add option-groups capability to Choices. 2013-08-29 22:00:53 -06:00
Tony Aldridge
b706aee4a9 Added tests to improve coverage 2013-08-25 08:29:10 +01:00
Tony Aldridge
1a6d9a193e Removed redundant inequality method on Choices 2013-08-24 10:51:25 +01:00
Tony Aldridge
3485df15f2 Merge remote-tracking branch 'upstream/master'
Conflicts:
	README.rst
2013-08-24 10:36:21 +01:00
Tony Aldridge
003ad70805 Added equality methods to Choices objects, and overrode + for Choices
for easy concatenation with other Choices and choice-like iterables.
Also wrote tests for them, and extended the readme to reflect this
2013-08-23 16:58:10 +01:00
Den Lesnov
18999c43dd Added deepcopy test 2013-08-21 17:15:19 +04:00
Trey Hunner
e1faec7577 Merge pull request #73 from silonov/json_fields_support
Json fields support
2013-08-17 01:46:31 -07:00
Trey Hunner
2679f6114b Merge branch 'silonov-json_fields_support'
Conflicts:
	CHANGES.rst
	model_utils/tests/tests.py
2013-08-17 01:40:09 -07:00
Den Lesnov
5f291a6a4a Implemented __deepcopy__ to avoid infinite recursion in __getattr__ while deepcopying a Choices instance 2013-08-15 15:01:09 +04:00
Mikhail Silonov
ef510d53dd Removed reinvented wheel 2013-08-12 13:22:34 +04:00
Trey Hunner
15910e04e7 Merge branch 'field-tracker-inheritance'
Conflicts:
	CHANGES.rst
2013-08-11 18:49:20 -07:00
silonov
f20e723952 Added more general mutable fields support instead of json-specific 2013-08-11 19:32:45 +04:00
silonov
630741b423 Added JSONEncoder().encode(...) check for json-like fields 2013-08-10 01:59:06 +04:00
Carl Meyer
9a3abce7f5 Update testing idioms. 2013-08-08 09:43:46 -06:00
Carl Meyer
a66f2769cb Merge remote-tracking branch 'silonov/save_with_untracked_updated_fields'
* silonov/save_with_untracked_updated_fields:
  Fixed a bug causing `KeyError` when saving with the parameter `update_fields` in which there are untracked fields.
2013-08-08 09:29:04 -06:00
Mikhail Silonov
8c6f343111 Added JSON Fields support 2013-08-08 18:02:12 +04:00
Mikhail Silonov
b9f954074c Fixed a bug causing KeyError when saving with the parameter update_fields in which there are untracked fields. 2013-08-08 13:22:25 +04:00
Trey Hunner
9050d60295 Merge pull request #68 from carljm/docs
Documentation
2013-08-08 01:00:51 -07:00
Trey Hunner
a7c6ff9392 Set version in setup.py docs automatically 2013-08-07 22:52:39 -07:00
Keryn Knight
6f0cf2a96c first pass at tests for the __contains__ functionality
just implemented.
2013-08-02 12:24:44 +01:00
Keryn Knight
f89369f9ac Implement __contains__ ('x' in Choices('x')) for Choices objects.
In Choices, `_choice_dict` appears to be a definitive location of all
internal/DB representations, so it seems the best target for finding
out if the given item is part of the sequences.
2013-08-02 12:23:48 +01:00
Trey Hunner
75646a1874 Improve FieldTracker tests for inherited models 2013-07-30 10:16:43 -07:00
Trey Hunner
98f078d718 Allow FieldTracker to work in child models
Fixes #57.
2013-07-29 12:54:49 -07:00
Carl Meyer
9a5a2bcf88 Use proper unittest test-skipping. 2013-07-25 12:16:11 -05:00
Carl Meyer
bcc8ad3a64 Update tox.ini for Django 1.6 stable branch, South supporting Py3. 2013-07-25 11:58:46 -05:00
Eran Rundstein
5687d9836d create basic failing test case for inherited models and tracker 2013-06-06 13:24:43 +00:00
Trey Hunner
b4efe66059 Round numbers that Python 2 and 3 agree on 2013-06-03 12:45:32 -07:00
Trey Hunner
aaf2219013 Add tests for tracking non-field attributes 2013-06-03 12:08:01 -07:00
Carl Meyer
44b0e42dd1 Merge branch 'master' into fk-fix
* master:
  Remove misinformation from changelog; oops.
  Tweak AUTHORS and changelog.
  PassThroughManager calls superclass `get_query_set`.
  Update AUTHORS and changelog.
  Fix tox.ini so runtests.sh works.
  Test and fix for second grandchild bug.
2013-06-03 11:54:46 -06:00
Trey Hunner
1474a48084 Improve FieldTracker docstrings 2013-05-28 10:14:49 -07:00
Andy Freeland
7e381179e4 PassThroughManager calls superclass get_query_set.
As discussed in #31, PassThroughManager and
PassThroughManager.for_queryset_class() would ignore the superclass
version of `get_query_set`.
2013-05-26 16:04:47 -04:00
Trey Hunner
9dc3dacabf Fix FieldTracker's has_changed (fixes gh-51)
The FieldTracker has_changed method no longer returns True for any input
when the instance is unsaved and no longer raises a FieldError for
fields after the first save.  The original ModelTracker behavior is
maintained.
2013-05-24 22:22:20 -07:00
Trey Hunner
d28f3860cf Change FieldTracker `current` for unsaved model
Return None values instead of an empty dict
2013-05-23 16:38:12 -07:00
Trey Hunner
d190239c1f Improve docstrings and variables for FieldTracker 2013-05-23 16:25:10 -07:00
Trey Hunner
54c996f17f Don't compare FK instances in FieldTracker 2013-05-23 13:18:21 -07:00
Trey Hunner
4bae3e999b Fix foreign key tests for FieldTracker 2013-05-23 13:16:49 -07:00
Trey Hunner
6532784acd Create FieldTracker that mirrors ModelTracker 2013-05-23 12:50:34 -07:00
Trey Hunner
97e0f5edbf Change failing test to pass for ModelTracker 2013-05-23 12:34:15 -07:00
Bojan Mihelac
ea899d17a0 Added test_number_of_queries in ModelTrackerTestCase 2013-05-23 12:31:21 -07:00
Trey Hunner
a141063f34 Add tests for ForeignKey fields with ModelTracker 2013-05-23 12:31:20 -07:00
Alex Orange
1e84465276 Test and fix for second grandchild bug.
Bug is, second grandchild of a given child will get cast to the child
rather then the grandchild.
2013-05-21 14:23:23 -06:00
Carl Meyer
216d0b7095 Fix GH-41: re-add get_FOO_display method to models with StatusField. 2013-05-02 11:33:48 -06:00
Trey Hunner
c2f3bd8a77 Fix deprecated assertion methods in tests 2013-04-12 17:13:36 -07:00
Trey Hunner
396bb7ac3f Remove with_statement import (was needed for 2.5) 2013-04-12 17:13:36 -07:00
Trey Hunner
32bb718107 Remove reduntant "as" in import 2013-04-12 17:13:35 -07:00
Trey Hunner
e6293d9b0c Remove datetime imports unused by Django 1.4+ 2013-04-12 17:13:31 -07:00
Trey Hunner
f7f7cc0953 Fix repr tests for Python 2 (no string comparison) 2013-04-12 17:13:31 -07:00
Trey Hunner
4f2673e6a4 Fix str/unicode problems in Python 3
Changes:
- Use unicode_literals from the future for Python 2.6.5+
- Use six's text_type for proper unicode use in Python 2/3
2013-04-12 14:16:42 -07:00
Trey Hunner
81c7e40e60 Fix iterator/list problems for Python 3 support 2013-04-12 14:16:42 -07:00
Carl Meyer
4ee0c39db3 Add tests for StatusField no_check_for_status. 2013-04-10 12:52:53 -06:00
Trey Hunner
59e484e17f Fix StatusField bug
Fixes #29
2013-04-09 14:28:53 -07:00
Trey Hunner
2769e79796 Fix BooleanField default (for Django trunk) 2013-03-27 22:43:21 -07:00
Trey Hunner
4156fa40e9 Add test for ModelTracker before first model save 2013-03-27 16:59:42 -07:00
Trey Hunner
cddcbd4e42 ModelTracker: pass kwargs to parent save correctly
Fixes usage of update_fields in save()
2013-03-27 16:59:42 -07:00
Trey Hunner
98016dbd50 ModelTracker: check DB after using update_fields 2013-03-27 16:59:42 -07:00
Trey Hunner
d24dbc6c38 Fix ModelTracker for obj.save(update_fields=[...]) 2013-03-27 16:59:42 -07:00
Trey Hunner
d9c415c5cd Add ModelTracker test for save(update_fields=[...]) 2013-03-27 16:59:42 -07:00
Carl Meyer
147fdf5d89 Remove silly uses of setattr. 2013-02-21 16:31:29 -07:00
Felipe Prenholato
cce804da4e Assert that StatusField respects default arguments. 2013-02-21 17:08:15 -03:00
Trey Hunner
cf153f3c06 Add test for ModelTracker descriptor on class 2013-02-18 20:13:39 -08:00
Trey Hunner
335500018a Make `from model_utils import ModelTracker` work 2013-02-18 20:09:08 -08:00
Trey Hunner
b1979a52b3 Add tests for multiple model trackers 2013-02-18 20:06:52 -08:00
Trey Hunner
7ac6e8a81c Add tests for ModelTracker.current method 2013-02-18 17:33:26 -08:00
Trey Hunner
45ac3bd03f Fix return value of ModelTracker.current pre-save 2013-02-18 17:32:30 -08:00
Trey Hunner
1ae2effc22 Merge ModelTracker and descriptor classes 2013-02-18 16:36:05 -08:00
Trey Hunner
a68649c9e7 Rename current_fields to current 2013-02-18 16:26:54 -08:00
Trey Hunner
f4512642cb Remove unnecessary use of setattr 2013-02-18 16:22:11 -08:00
Trey Hunner
676424e388 Move ModelTracker to tracker module 2013-02-18 16:21:14 -08:00
Trey Hunner
c528a347e0 Add ModelTracker with tests 2013-02-16 14:52:31 -08:00
Carl Meyer
579abf8e66 Fix calling create() on a related manager based on PassThroughManager. 2013-02-12 14:05:31 -07:00
Carl Meyer
cf2c97b620 Avoid overriding prior calls to select_related in select_subclasses. 2013-02-01 22:53:11 -07:00
Carl Meyer
93a1a44ee7 Updates to multi-level support for InheritanceManager. 2013-02-01 22:38:14 -07:00
Ivan Virabyan
937b3e018f Support for multi-level inheritance in InheritanceManager 2013-01-31 18:27:16 +04:00
Carl Meyer
246fb81813 Revert addition of UpdateOrCreateMixin; reaches 100% test coverage. 2013-01-27 14:16:58 -08:00
Carl Meyer
983fab0341 Clean up some uses of hasattr; no need to support 1.1 any longer. 2013-01-27 13:41:03 -08:00
Carl Meyer
6ae66e0153 Removed a bunch of deprecated code. 2013-01-27 13:30:31 -08:00
Carl Meyer
a9ac3685fb Removed deprecated ChoiceEnum; moved Choices out of __init__.py. 2013-01-27 13:19:45 -08:00
Carl Meyer
f7f54a03b0 Enable pickling PassThroughManager in Django 1.5. 2013-01-26 22:10:14 -08:00
Carl Meyer
a76006a3b2 Merge UpdateOrCreateMixin. 2013-01-26 17:20:52 -08:00
Carl Meyer
05f1dc97b3 Set use_for_related_fields=True on QueryManager. 2013-01-26 17:09:16 -08:00
Carl Meyer
ec1870c98a Merge pull request #19 from DXist/master
Extra deny methods for PassThroughManager
2013-01-26 17:05:15 -08:00
Carl Meyer
41607c0b56 Resolve duplication between two pull requests for Choices.__len__. 2013-01-26 17:04:15 -08:00
Carl Meyer
4217dbd7fe Merge pull request #16 from ryankask/choices-len
__len__ method for Choices
2013-01-26 17:01:06 -08:00
Carl Meyer
aa8c79eeb4 More straightforward, efficient implementation for InheritanceQuerySet. 2013-01-26 16:46:51 -08:00
Carl Meyer
8808aa05b8 Merged in jgsogo/django-model-utils (pull request #5)
patch to issue #16
2013-01-26 16:40:26 -08:00
Rinat Shigapov
e9e57e096f deny methods for queryset copy 2012-11-08 12:24:17 +04:00
Javier García Sogo
575a5e1340 avoid plain except 2012-11-05 13:43:42 +01:00
James Oakley
9ea6605226 Add __len__() method to Choices 2012-10-30 11:01:57 -07:00
Carl Meyer
2376c931ab Update PassThroughManager docstring to match README docs; thanks atreanor. 2012-09-27 09:48:04 -06:00
Antti Kaihola
21371e3ea4 Added missing imports for UpdateOrCreateMixin 2012-08-27 15:21:52 +03:00
Javier Garcia Sogo
6ab6da083c patch to issue#16 2012-07-06 22:12:58 +02:00
Antti Kaihola
c83c14c46f Added an UpdateOrCreateMixin for creating custom managers and querysets which have an .update_or_create() method (see Django ticket #3182). 2012-06-08 16:47:28 +03:00
Ryan Kaskel
7cbfbdb453 len support for Choices. 2012-05-10 12:07:42 +01:00
Donald Stufft
31e5fb3c4a updated to use the new 1.4 timezones 2012-01-07 17:43:39 -05:00
Carl Meyer
4746180c4d Improved fix for annotations and InheritanceQuerySet. Thanks Facundo Gaich. 2012-01-03 16:47:33 -07:00
Carl Meyer
c35746a445 Fixed annotation of InheritanceQuerySets. Thanks Jeff Elmore. 2012-01-03 15:47:41 -07:00
Carl Meyer
5710c8b504 Dropped support for obsolete Python 2.5 and Django 1.1. 2012-01-03 15:40:17 -07:00
Carl Meyer
8c6af71713 Updated PassThroughManager.for_queryset_class for less ambiguous behavior in case of incorrect usage. 2011-12-05 17:08:51 -07:00
Ryan Kaskel
6afa9d566d Add convenience method to PassThroughManager. 2011-12-04 13:57:16 +00:00
Carl Meyer
b2aa8c2692 Merged. 2011-10-26 11:12:42 -06:00
smacker
b06ba20fe9 test and docs for get_subclass 2011-10-26 23:06:55 +06:00
smacker
9ac5877d29 add get_subclass method 2011-10-26 12:01:37 +06:00
Jeff Elmore
37e4eecace Added explicit test of using 'get' method with select_subclasses
--HG--
extra : transplant_source : %9F%EA%C6%81%1D%BE%AA%0BQ5%A7%ECs%0Dwb%B8%B15%60
2011-07-02 11:58:14 -04:00
Carl Meyer
b7c5a59390 Fixed using SplitField on an abstract base model class. 2011-04-28 20:59:52 -05:00
Carl Meyer
ab70211d29 Removed unneeded creation_counter increment. 2011-04-28 19:59:46 -05:00
Carl Meyer
5c5abdce23 Added use_for_related_fields=True to InheritanceManager. Fixes #8. Thanks munhitsu for the report.
Note that the tests added for this feature pass even without the change to
InheritanceManager, because use_for_related_fields is broken in Django and
always acts as if True for reverse FKs and M2Ms.
(http://code.djangoproject.com/ticket/14891)
2011-04-16 16:19:55 -05:00
Carl Meyer
69d0985db1 Started deprecation for manager_from, InheritanceCastModel, and Django 1.1 support. 2011-04-16 14:51:14 -05:00
Carl Meyer
c514c68676 Updated test-runner. 2011-04-16 14:49:33 -05:00
Carl Meyer
7c19b761e2 Merged in fix for Django 1.1 recursion error from Paul McLanahan. 2011-03-30 10:20:37 -04:00
Paul McLanahan
d8798fb784 Fixed a recursion error in Django 1.1 2011-03-29 21:57:49 -04:00
Carl Meyer
36b99304c2 Merged in PassThroughManager from Paul McLanahan. 2011-03-29 13:10:50 -04:00
Carl Meyer
e418cc909a Fixed issue #6, bug with InheritanceManager and descriptor fields (e.g. FileField).
Thanks zyegfryed for the fix and sayane for tests.
2011-03-29 12:47:25 -04:00
Carl Meyer
1a8f7c5087 Added tox config. 2011-03-29 12:41:22 -04:00
zyegfryed
ae64c23b39 Fixed related subclasses parsing. Was raising AttributeError on FileField. 2011-03-29 14:59:50 +02:00
Paul McLanahan
04c848e8c7 Added tests for PassThroughManager. 2011-03-09 14:44:10 -05:00
Paul McLanahan
c624d7a301 Added PassThroughManager to managers.
Added me to authors.
2011-03-08 13:52:32 -05:00
Carl Meyer
552f7c2009 Fixed #2 - Updated SplitField for 1.2-style prep_value method. 2011-02-18 16:45:39 -05:00
Carl Meyer
ac36cbf56c Added InheritanceManager, contributed by Jeff Elmore. 2010-11-23 12:48:23 -05:00
Carl Meyer
396dd9274f use manager_from for inheritance-casting 2010-10-05 09:01:26 -04:00
Carl Meyer
a2c67934ed additional test, docs cleanup 2010-10-05 08:59:25 -04:00
Gregor Müllegger
216db6c098 Creating a custom QuerySet subclass for InheritanceCastModel to provide a way to batch cast a queryset of parents into child types. It's (2 + m) queries instead of (1 + n * 2) now (n: number of returned objects, m: number of different types in the queryset). 2010-10-01 20:43:22 +02:00
Carl Meyer
1d4613e807 make tests compatible with pre-1.2 2010-09-24 10:30:58 -04:00
Carl Meyer
5da38ee0c6 manager_from bugfix from George Sakkis; fixes #1 2010-08-16 17:58:16 -04:00
Carl Meyer
afafdd2bf9 make manager_from Django 1.1 compatible 2010-07-30 22:45:45 -04:00
Carl Meyer
cfd6578fe5 improve test coverage 2010-07-30 22:36:24 -04:00
Carl Meyer
aed583f763 added manager_from (thanks George Sakkis) 2010-07-30 22:09:46 -04:00
Carl Meyer
726f0de1dd minor cleanup 2010-04-27 13:25:45 -04:00
Carl Meyer
be0f667204 fix typos in test names 2010-04-27 13:19:08 -04:00
Jannis Leidel
911b5223c8 Fixed bug which prevented the StatusModel and TimeframedModel to get the appropriate QueryManager instances added dynamically before instantiation. 2010-04-26 22:30:01 +02:00
Jannis Leidel
8e2893f1b7 Fixed typo. 2010-04-23 12:47:38 +02:00
Jannis Leidel
e4564f73db Automated merge with http://bitbucket.org/carljm/django-model-utils/ 2010-04-23 12:45:15 +02:00
Jannis Leidel
43138fbaaa Extended South introspection rules to handle StatusField and MonitorField. 2010-04-23 12:44:59 +02:00
Carl Meyer
d4951f6651 added triple option in Choices to split db representation from code constant 2010-04-22 13:02:25 -04:00
Carl Meyer
238571ed43 docs, AUTHORS, Changelog... 2010-04-16 00:37:12 -04:00
Carl Meyer
f64f16b053 Choices should be indexable as if it were a two-tuple 2010-04-16 00:11:31 -04:00
Carl Meyer
acbf46abb2 remove duplication between StatusModel tests 2010-04-15 23:59:05 -04:00
Carl Meyer
3e78add2d5 split out TimeFramedModel tests 2010-04-15 23:55:24 -04:00
Carl Meyer
d95f9efcf1 consistent PEP8 test method names 2010-04-15 23:52:31 -04:00
Carl Meyer
545bccf3ce convert StatusModifiedField to generic MonitorField, use post_init signal instead of extra DB query 2010-04-15 23:47:28 -04:00
Carl Meyer
c43b1ba99d remove previous_status from StatusField public API
I may be missing the use case, but this seems too ephemeral to be
useful (only exists on same instance after a save, can't rely on it
being there in general). If it's just an implementation detail for
StatusModifiedField, it doesn't need to be tested in public API for
StatusField.
2010-04-15 23:07:12 -04:00
Carl Meyer
fecda79f5c deprecate ChoiceEnum and document Choices 2010-04-15 22:54:37 -04:00
Carl Meyer
02b2082e90 Fix Choices docstring, minor code changes:
- remove __getitem__, no need for it anymore
- remove implicit lowercasing (principle of least surprise: strings are usually case sensitive)
2010-04-15 22:32:33 -04:00
Carl Meyer
cb46293b0a merge backout 2010-04-15 22:30:03 -04:00
Carl Meyer
8efaf852c8 Backed out changeset c05246980ddf 2010-04-15 22:16:10 -04:00