Skip to content

Commit 18f2ec1

Browse files
committed
Fixed a bug with related object fetching.
1 parent cd2a2fd commit 18f2ec1

File tree

5 files changed

+5
-116
lines changed

5 files changed

+5
-116
lines changed

README

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What the heck is this?
22
----------------------
33

4-
There are a lot of versioning apps out there, either in a state of decrepitude, or functional but with a colvoluted or suboptimal design. This app intends to become the de-facto standard to manage revisions in Django.
4+
There are a lot of Django versioning apps out there, either in a state of decrepitude, or functional but with a colvoluted or suboptimal design. This app intends to become the de-facto standard to manage revisions in Django.
55

6-
But not quite yet. Because it's more alpha than alpha and it has failing tests. Just so y'know. You can run the tests yourself with python revisions/tests/testrunner.py
6+
Recently crawled out of alpha and has a good test suite, but it's not quite production-grade. Just so y'know.

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=============================================
2-
Welcome to django-versioning's documentation!
2+
Welcome to django-versioning's documentation!
33
=============================================
44

55
Contents:

docs/roadmap.rst

-16
This file was deleted.

revisions/models.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def revert_to(self, criterion):
8080
revert_to_obj.save()
8181
return revert_to_obj
8282

83-
8483
def get_latest_revision(self):
8584
return self.get_revisions().order_by('-vid')[0]
8685

@@ -119,9 +118,9 @@ def _get_related_objects(self, relatedmanager):
119118
# kind of convoluted deep dive into the internals of the related class.
120119
#
121120
# By all means, I'd welcome suggestions for prettier code.
122-
123121
ref_name = self._meta._name_map[related_model_name][0].field.name
124-
objs = related_model._default_manager.filter(**{ref_name + '__in': self.get_revisions()})
122+
pks = [story.pk for story in self.get_revisions()]
123+
objs = related_model._default_manager.filter(**{ref_name + '__in': pks})
125124

126125
return objs
127126

revisions/utils.py

-94
This file was deleted.

0 commit comments

Comments
 (0)