Changes between Initial Version and Version 1 of Ticket #10723


Ignore:
Timestamp:
04/03/2009 09:54:04 PM (6 years ago)
Author:
mtredinnick
Comment:

(Reformatted description to avoid lots of side-scrolling.)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10723

    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Milestone changed from to 1.1
    • Property Needs documentation unset
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #10723 – Description

    initial v1  
    11My models is:
    22{{{
     3#!python
    34class Type(models.Model):
    45    id = models.AutoField(primary_key=True)
     
    1718
    1819{{{
    19 Type.objects.filter(Q(activeposts__rubrica__pk=112) & Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
     20#!python
     21Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
     22   Q(activeposts__user_id__in= 1,2,3])). \
     23   annotate(count=Count('activeposts')).query.as_sql()
    2024}}}
    2125
     
    2327
    2428{{{
    25 ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER JOIN `doska_active_new` ON (`doska_type`.`id` = `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s  AND `doska_active_new`.`user_id` IN (%s, %s, %s)) GROUP BY `doska_type`.`id` ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
     29#!sql
     30('SELECT `doska_type`.`id`, `doska_type`.`slug`,
     31`doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
     32FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
     33      ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
     34WHERE (`doska_active_new`.`rubrica_id` = %s
     35   AND `doska_active_new`.`user_id` IN (%s, %s, %s))
     36GROUP BY `doska_type`.`id`
     37ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
    2638}}}
    2739But
    2840{{{
    29 Type.objects.filter(Q(activeposts__rubrica__pk=112) & ~Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
     41#!python
     42Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
     43~Q(activeposts__user_id__in=[1,2,3])). \
     44annotate(count=Count('activeposts')).query.as_sql()
    3045}}}
    3146
     
    3348
    3449{{{
    35 ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER JOIN `doska_active_new` ON (`doska_type`.`id` = `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s  AND NOT (`doska_type`.`id` IN (SELECT U1.`type_id` FROM `doska_active_new` U1 WHERE U1.`user_id` IN (%s, %s, %s)))) GROUP BY `doska_type`.`id` ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
     50#!sql
     51('SELECT `doska_type`.`id`, `doska_type`.`slug`,
     52`doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
     53FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
     54   ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
     55WHERE (`doska_active_new`.`rubrica_id` = %s
     56   AND NOT (`doska_type`.`id` IN (
     57      SELECT U1.`type_id`
     58      FROM `doska_active_new` U1
     59      WHERE U1.`user_id` IN (%s, %s, %s))))
     60GROUP BY `doska_type`.`id`
     61ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
    3662}}}
Back to Top