Django 1.0.2-1 If I do:
>>> object=models.software.objects.get(id=267) >>> print models.software_installation.objects.filter(software=object) [] >>> print models.software_installation.objects.filter(software=object).count() 10 Huh? First statement says there are no results, next one says there are 10. If I spy on the packets, I see this in the SQL for the first statement: ... LEFT OUTER JOIN `inventory_license_key` ON (`inventory_software_installation`.`license_key_id` = `inventory_license_key`.`id`) INNER JOIN `inventory_license` ON (`inventory_license_key`.`license_id` = `inventory_license`.`id`) ... If I remove the inner join part (and the reference to it in the order part), and run the SQL on the server, then it works. `inventory_software_installation`.`license_key_id` == NULL on the rows in question (the model specifies null=True). I have a suspicion that the above SQL doesn't work because it requires a inventory_license object, however there is no inventory_license_key object there is no inventory_license object. The relevant definitions (I can provide more details on request) are: class software_installation(models.Model): [...] software = models.ForeignKey(software) [...] license_key = models.ForeignKey(license_key,null=True,blank=True) [...] class license_key(models.Model): [...] license = models.ForeignKey(license) [...] class license(models.Model): [...] Any ideas? Is this a django bug? If so is it a known issue? Thanks Brian May --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. 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 -~----------~----~----~----~------~----~------~--~---