Commit graph

181 commits

Author SHA1 Message Date
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