mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-04-18 22:11:05 +00:00
Change get_for_objects to distinguish between number and text keys.
This commit is contained in:
parent
a35e0134e6
commit
16a8b158e0
1 changed files with 5 additions and 1 deletions
|
|
@ -92,7 +92,11 @@ class LogEntryManager(models.Manager):
|
|||
content_type = ContentType.objects.get_for_model(queryset.model)
|
||||
primary_keys = queryset.values_list(queryset.model._meta.pk.name, flat=True)
|
||||
|
||||
return self.filter(content_type=content_type).filter(Q(object_id__in=primary_keys) | Q(object_pk__in=primary_keys)).distinct()
|
||||
if isinstance(primary_keys[0], integer_types):
|
||||
return self.filter(content_type=content_type).filter(Q(object_id__in=primary_keys)).distinct()
|
||||
else:
|
||||
return self.filter(content_type=content_type).filter(Q(object_pk__in=primary_keys)).distinct()
|
||||
|
||||
|
||||
def get_for_model(self, model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue