I am trying to abstract a log app that I have made for my project to make it more DRY. In order to achieve this I have tried to implement Generic FKs
class Modification(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') action = models.PositiveSmallIntegerField(choices=ACTION_TYPE_CHOICES, db_index=True) modifier = models.ForeignKey(User) modified_on = models.DateTimeField(auto_now=True) This appears to function as intended. I also have another app that I would like to query the logs for: class NewApp(models.Model): prefix = models.CharField(max_length=50,choices=PREFIXES, blank=True) first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) modifications = generic.GenericRelation(Modification) Is it possible please to query and return the relevant results from both models in one queryset? For example, I want to do something similar to this: content_type = ContentType.objects.get_for_model(NewApp) last_modified = Modification.objects.select_related().distinct('object_id').filter(content_type=content_type).order_by('object_id', '-modified_on') The above, doesn't, but I need to achieve the fields from NewApp as well as Modification. Thank you for any assistance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/OO4VfEagK6EJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.