Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-19 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by anonymous):

 * cc: elsdoer...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-19 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Comment (by olivius ):

 Typo: changed  ammount to amount in class Transaction

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-19 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Comment (by olivius ):

 models.py:


 {{{
 class Account(models.Model):
 accountname = models.CharField(max_length=20)
 account_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)

 def __unicode__(self):
 return self.account


 class Category(models.Model):
 category_name = models.CharField(max_length=50)
 category_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)
 def __unicode__(self):
 return self.category


 class Transaction(models.Model):
 category= models.ForeignKey(Category)
 account_from= models.ForeignKey(Account,
 related_name='account_from')
 account_to  = models.ForeignKey(Account,
 related_name='account_to')
 creator = models.ForeignKey(User)
 label   = models.CharField(_('label'), max_length=30)
 description = models.TextField(_('description'), blank=True)
 amount  = models.DecimalField(_('amount'),max_digits=8,
 decimal_places=2)
 created_at  = models.DateTimeField(_('created at'),
 default=datetime.now)
 updated_at  = models.DateTimeField(_('updated at'))

 def __unicode__(self):
 return self.label

 }}}

 shell:


 {{{
 >>>
 
transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')
 >>> print transactions
 Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 239, in __getitem__
 return list(qs)[0]
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 163, in __len__
 self._result_cache.extend(list(self._iter))
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 294, in iterator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-18 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Old description:

> models.py:[[BR]]
> {{{
> class Account(models.Model):
> accountname = models.CharField(max_length=20)
> account_creator = models.ForeignKey(User)
> description = models.TextField(_('description'), blank=True)
>
> def __unicode__(self):
> return self.account
>

> class Category(models.Model):
> category_name = models.CharField(max_length=50)
> category_creator = models.ForeignKey(User)
> description = models.TextField(_('description'), blank=True)
> def __unicode__(self):
> return self.category
>

> class Transaction(models.Model):
> category= models.ForeignKey(Category)
> account_from= models.ForeignKey(Account,
> related_name='account_from')
> account_to  = models.ForeignKey(Account,
> related_name='account_to')
> creator = models.ForeignKey(User)
> label   = models.CharField(_('label'), max_length=30)
> description = models.TextField(_('description'), blank=True)
> ammount = models.DecimalField(_('amount'),max_digits=8,
> decimal_places=2)
> created_at  = models.DateTimeField(_('created at'),
> default=datetime.now)
> updated_at  = models.DateTimeField(_('updated at'))
>
> def __unicode__(self):
> return self.label
> }}}
>
> shell:[[BR]]
>
> '''transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')'''
>
> '''print transactions'''
> {{{
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 239, in __getitem__
> return list(qs)[0]
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 163, in __len__
> self._result_cache.extend(list(self._iter))
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 294, in iterator
> setattr(obj, aggregate, row[i+aggregate_start])
> IndexError: tuple index out of range
> }}}

New description:

 models.py:[[BR]]
 {{{
 class Account(models.Model):
 accountname = models.CharField(max_length=20)
 account_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)

 def __unicode__(self):
 return self.account


 class Category(models.Model):
 category_name = models.CharField(max_length=50)
 category_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)
 def __unicode__(self):
 return self.category


 class Transaction(models.Model):
 category= models.ForeignKey(Category)
 account_from= models.ForeignKey(Account,
 related_name='account_from')
 account_to  = models.ForeignKey(Account,
 related_name='account_to')
 creator = models.ForeignKey(User)
 label   = models.CharField(_('label'), max_length=30)
 description = models.TextField(_('description'), blank=True)
 ammount = models.DecimalField(_('amount'),max_digits=8,
 decimal_places=2)
 created_at  = models.DateTimeField(_('created at'),
 default=datetime.now)
 updated_at  = models.DateTimeField(_('updated at'))

 def __unicode__(self):
 return self.label
 }}}

 shell:[[BR]]

 {{{
 >>>
 
transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')
 >>> print transactions
 Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 239, in __getitem__
 return list(qs)[0]
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 163, in __len__
 self._result_cache.extend(list(self._iter))
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 294, in iterator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range
 }}}

Comment (by Alex):

 cleaned up the formatting of the description slightly.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~--

Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-18 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by anonymous):

 * cc: flo...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-18 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Old description:

> {{{
> models.py:[[BR]]
>
> class Account(models.Model):
> accountname = models.CharField(max_length=20)
> account_creator = models.ForeignKey(User)
> description = models.TextField(_('description'), blank=True)
>
> def __unicode__(self):
> return self.account
>

> class Category(models.Model):
> category_name = models.CharField(max_length=50)
> category_creator = models.ForeignKey(User)
> description = models.TextField(_('description'), blank=True)
> def __unicode__(self):
> return self.category
>

> class Transaction(models.Model):
> category= models.ForeignKey(Category)
> account_from= models.ForeignKey(Account,
> related_name='account_from')
> account_to  = models.ForeignKey(Account,
> related_name='account_to')
> creator = models.ForeignKey(User)
> label   = models.CharField(_('label'), max_length=30)
> description = models.TextField(_('description'), blank=True)
> ammount = models.DecimalField(_('amount'),max_digits=8,
> decimal_places=2)
> created_at  = models.DateTimeField(_('created at'),
> default=datetime.now)
> updated_at  = models.DateTimeField(_('updated at'))
>
> def __unicode__(self):
> return self.label
> }}}
>
> shell:[[BR]]
>
> '''transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')'''
>
> '''print transactions'''
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 239, in _
> _getitem__
> return list(qs)[0]
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 163, in _
> _len__
> self._result_cache.extend(list(self._iter))
>   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> 294, in i
> terator
> setattr(obj, aggregate, row[i+aggregate_start])
> IndexError: tuple index out of range

New description:

 models.py:[[BR]]
 {{{
 class Account(models.Model):
 accountname = models.CharField(max_length=20)
 account_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)

 def __unicode__(self):
 return self.account


 class Category(models.Model):
 category_name = models.CharField(max_length=50)
 category_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)
 def __unicode__(self):
 return self.category


 class Transaction(models.Model):
 category= models.ForeignKey(Category)
 account_from= models.ForeignKey(Account,
 related_name='account_from')
 account_to  = models.ForeignKey(Account,
 related_name='account_to')
 creator = models.ForeignKey(User)
 label   = models.CharField(_('label'), max_length=30)
 description = models.TextField(_('description'), blank=True)
 ammount = models.DecimalField(_('amount'),max_digits=8,
 decimal_places=2)
 created_at  = models.DateTimeField(_('created at'),
 default=datetime.now)
 updated_at  = models.DateTimeField(_('updated at'))

 def __unicode__(self):
 return self.label
 }}}

 shell:[[BR]]

 
'''transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')'''

 '''print transactions'''
 {{{
 Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 239, in __getitem__
 return list(qs)[0]
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 163, in __len__
 self._result_cache.extend(list(self._iter))
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 294, in iterator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range
 }}}

Comment (by kmtracey):

 (Fixed formatting.)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You receive

Re: [Django] #10064: error: annotate doesn't support select_related

2009-01-18 Thread Django
#10064: error: annotate doesn't support select_related
--+-
  Reporter:  olivius  | Owner:  
Status:  new  | Milestone:  post-1.0
 Component:  ORM aggregation  |   Version:  SVN 
Resolution:   |  Keywords:  annotate
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by olivius ):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #10064: error: annotate doesn't support select_related

2009-01-18 Thread Django
#10064: error: annotate doesn't support select_related
+---
 Reporter:  olivius |  Status:  new
Milestone:  post-1.0|   Component:  ORM aggregation
  Version:  SVN |Keywords:  annotate   
Stage:  Unreviewed  |   Has_patch:  0  
+---
 {{{
 models.py:[[BR]]

 class Account(models.Model):
 accountname = models.CharField(max_length=20)
 account_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)

 def __unicode__(self):
 return self.account


 class Category(models.Model):
 category_name = models.CharField(max_length=50)
 category_creator = models.ForeignKey(User)
 description = models.TextField(_('description'), blank=True)
 def __unicode__(self):
 return self.category


 class Transaction(models.Model):
 category= models.ForeignKey(Category)
 account_from= models.ForeignKey(Account,
 related_name='account_from')
 account_to  = models.ForeignKey(Account,
 related_name='account_to')
 creator = models.ForeignKey(User)
 label   = models.CharField(_('label'), max_length=30)
 description = models.TextField(_('description'), blank=True)
 ammount = models.DecimalField(_('amount'),max_digits=8,
 decimal_places=2)
 created_at  = models.DateTimeField(_('created at'),
 default=datetime.now)
 updated_at  = models.DateTimeField(_('updated at'))

 def __unicode__(self):
 return self.label
 }}}

 shell:[[BR]]

 
'''transactions=Transaction.objects.select_related('category','account_from','account_to').annotate(Sum('amount')).order_by('category','updated_at')'''

 '''print transactions'''

 Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 239, in _
 _getitem__
 return list(qs)[0]
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 163, in _
 _len__
 self._result_cache.extend(list(self._iter))
   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
 294, in i
 terator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---