On Monday, November 6, 2017 at 9:15:09 PM UTC+1, Matthew Pava wrote: > > Maybe you are expecting too much from the user interface. Shouldn’t you > at least request from the user what primary object you are looking for? >
The primary model is always that one that is closest to "device"; step 2 of the process already takes this into account and returns the path in the best order, with the primary model being returned first. > Ultimately, your Django ORM code would look like this for your example, if > I follow your arrows correctly: > > Device.objects.filter(hostname__contains= 'localhost ', > package__name__contains= 'unix ', interface__IP__address__contains= '192') > This would perform the right query, but would not provide me with a total. It would also be impossible to do paging, because slicing the result does not take into account that the LEFT JOIN multiplies the number of total rows. -Samuel > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f1c92f41-ce59-47c5-9a82-6af38467a536%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.