mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[full-history]
* Added a filter for specific ID * Changed "offset" and "revision" to **kwargs arguments git-svn-id: http://code.djangoproject.com/svn/django/branches/full-history@3640 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
56642885be
commit
cd54edf084
@ -21,14 +21,23 @@ CHANGE_TYPES = (
|
|||||||
|
|
||||||
class ChangeLogManager(models.Manager):
|
class ChangeLogManager(models.Manager):
|
||||||
|
|
||||||
def get_version(self, object, offset=0):
|
def get_version(self, object, **kwargs):
|
||||||
"""
|
"""
|
||||||
Returns 'current-offset' revision of the 'object'
|
Returns 'current-offset' revision of the 'object'
|
||||||
"""
|
"""
|
||||||
|
if not kwargs['offset']: offset=0
|
||||||
|
|
||||||
ct = ContentType.objects.get_for_model(object)
|
ct = ContentType.objects.get_for_model(object)
|
||||||
return self.get_query_set().filter(
|
|
||||||
content_type=ct.id).filter(
|
if kwargs['revision']:
|
||||||
object_id=object.id)[offset]
|
return self.get_query_set().filter(
|
||||||
|
content_type=ct.id).filter(
|
||||||
|
object_id=object.id).filter(
|
||||||
|
pk=revision)[offset]
|
||||||
|
else:
|
||||||
|
return self.get_query_set().filter(
|
||||||
|
content_type=ct.id).filter(
|
||||||
|
object_id=object.id)[offset]
|
||||||
|
|
||||||
def list_history(self, object, **kwargs):
|
def list_history(self, object, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user