Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'sc/master' into django19_110_111-compat…
Browse files Browse the repository at this point in the history
…ibility
  • Loading branch information
Jeckelmann Manuel authored and Jeckelmann Manuel committed Sep 18, 2017
2 parents 6531c3a + c9c9bf0 commit cd8a416
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ before_script:

# Run tests
script:
tox -e $TOX_ENV
tox

# Run coveralls
after_success:
Expand Down
6 changes: 6 additions & 0 deletions docs/doc/historization_with_cleanerversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ Versioning an object in a ManyToMany relationship requires 3 steps to be done, i
.. image:: ../images/clone_m2m_item_3.png
:align: center

The records in ManyToMany intermediary tables are versioned: they have ``version_birth_date``,
``version_start_date`` and ``version_end_date`` columns. The ForeignKey columns in ManyToMany
Intermediary tables store the ``id`` of the referenced records. Note that this is different than
the VersionedForeignKeys in Versionable models, which store the ``identity`` of the referenced objects.
This is transparent in normal usage, but can be important to keep in mind when you need to write a query
that directly references the ForeignKey columns.

Removing objects from a versioned M2M relationship
--------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions versions_tests/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,8 +2321,7 @@ def test_reverse_fk_prefetch_queryset_with_historic_versions(self):
team = [t for t in current_city.prefetched_teams if t.name == 'team1.v2'][0]
self.assertSetEqual({'pl1.v2', 'pl2.v1'}, {p.name for p in team.prefetched_players})

# When a different time is specified for the prefetch queryset than for the base queryset:

# When a different time is specified for the prefetch queryset than for the base queryset:
with self.assertRaises(ValueError):
_ = City.objects.current.filter(name='city.v2').prefetch_related(
Prefetch(
Expand Down

0 comments on commit cd8a416

Please sign in to comment.