Changes between Initial Version and Version 1 of Ticket #10028


Ignore:
Timestamp:
Jan 16, 2009, 12:22:34 AM (16 years ago)
Author:
Malcolm Tredinnick
Comment:

Fixed the description to prevent eye bleeding. We really a need a "preview" button people can use to check things ... oh, wait.. we have one! :-)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10028

    • Property Summary no objects foundIncorrect SQL join construction
  • Ticket #10028 – Description

    initial v1  
    11Continued from <http://groups.google.com/group/django-users/browse_thread/thread/bc3ecc16c3def53b>
    2 
     2{{{
    33Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
    44[GCC 4.3.2] on linux2
     
    1212[]
    1313>>> print models.software_installation.objects.filter(software=object).query.as_sql()
    14 ('SELECT `inventory_software_installation`.`id`, `inventory_software_installation`.`software_id`, `inventory_software_installation`.`license_key_id` FROM `inventory_software_installation` INNER JOIN `inventory_software` ON (`inventory_software_installation`.`software_id` = `inventory_software`.`id`) LEFT OUTER JOIN `inventory_license_key` ON (`inventory_software_installation`.`license_key_id` = `inventory_license_key`.`id`) INNER JOIN `inventory_software` T4 ON (`inventory_license_key`.`software_id` = T4.`id`) INNER JOIN `inventory_license` ON (`inventory_license_key`.`license_id` = `inventory_license`.`id`) INNER JOIN `inventory_software` T6 ON (`inventory_license`.`software_id` = T6.`id`) WHERE `inventory_software_installation`.`software_id` = %s  ORDER BY `inventory_software`.`name` ASC, T4.`name` ASC, T6.`name` ASC, `inventory_license`.`vendor_id` ASC, `inventory_license_key`.`key` ASC', (267,))
    15 >>> quit()
     14('SELECT `inventory_software_installation`.`id`,
     15`inventory_software_installation`.`software_id`,
     16`inventory_software_installation`.`license_key_id` FROM
     17`inventory_software_installation` INNER JOIN `inventory_software`
     18ON (`inventory_software_installation`.`software_id` =
     19`inventory_software`.`id`) LEFT OUTER JOIN `inventory_license_key`
     20ON (`inventory_software_installation`.`license_key_id` =
     21`inventory_license_key`.`id`) INNER JOIN `inventory_software` T4 ON
     22(`inventory_license_key`.`software_id` = T4.`id`) INNER JOIN
     23`inventory_license` ON (`inventory_license_key`.`license_id` =
     24`inventory_license`.`id`) INNER JOIN `inventory_software` T6 ON
     25(`inventory_license`.`software_id` = T6.`id`) WHERE
     26`inventory_software_installation`.`software_id` = %s  ORDER BY
     27`inventory_software`.`name` ASC, T4.`name` ASC, T6.`name` ASC,
     28`inventory_license`.`vendor_id` ASC, `inventory_license_key`.`key`
     29ASC', (267,))
    1630
    17 --- cut ---
     31}}}
    1832
     33{{{
     34#!python
    1935class software(models.Model):
    2036    name = models.CharField(max_length=100)
     
    4056    class Meta:
    4157        ordering = ('software','license_key')
    42 
    43 --- cut ---
     58}}}
    4459
    4560The ordering Meta tag is important; if I remove the appropriate meta tags (I haven't worked out which ones yet), then everything works fine.
Back to Top