Re: [Django] #20795: Weird queryset behaviour and count() method

2013-07-26 Thread Django
#20795: Weird queryset behaviour and count() method
-+-
 Reporter:  maa@…|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:  invalid
 Severity:  Release blocker  | Triage Stage:
 Keywords:  count queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by anonymous):

 thanks for the update.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.407b7d32948e16ae614624441a7665d6%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20795: Weird queryset behaviour and count() method

2013-07-25 Thread Django
#20795: Weird queryset behaviour and count() method
-+-
 Reporter:  maa@…|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:  invalid
 Severity:  Release blocker  | Triage Stage:
 Keywords:  count queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by akaariai):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 There seems to be two things going on:
   1) You have overriden the model's init in a way that is incompatible to
 what Django expects. You can't add user arg to it, you might be able to
 use user kwarg instead. Basically, the signature must be `*args,
 **kwargs`, or Django will not be able to load your models back from DB.
   2) There is a bug in Python (IIRC) that causes errors inside list(qs) to
 swallow the error and return empty list. This is fixed in 1.6.

 So, marking this as invalid.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.832a36f89bf4ace005b3018e929fd777%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20795: Weird queryset behaviour and count() method

2013-07-25 Thread Django
#20795: Weird queryset behaviour and count() method
-+-
 Reporter:  maa@…|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:
 Keywords:  count queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by maa@…):

 I dont have a unicode method.
 len(EmailChangeLog.objects.all()) fails with AttributeError: 'int' object
 has no attribute 'username'
 traceback :
 {{{
 /home/maa/.virtualenvs/django_myproject/local/lib/python2.7/site-
 packages/django/db/models/query.pyc in __len__(self)
  88 self._result_cache = list(self._iter)
  89 else:
 ---> 90 self._result_cache = list(self.iterator())
  91 elif self._iter:
  92 self._result_cache.extend(self._iter)

 /home/maa/.virtualenvs/django_myproject/local/lib/python2.7/site-
 packages/django/db/models/query.pyc in iterator(self)
 309 obj = model_cls(**dict(zip(init_list,
 row_data)))
 310 else:
 --> 311 obj = model(*row_data)
 312
 313 # Store the source database of the object

 /home/maa/PycharmProjects/django_myproject/my_home/models.pyc in
 __init__(self, user, *args, **kwargs)
  41 super(EmailChangeLog, self).__init__(self, *args,
 **kwargs)
  42 salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
 ---> 43 username = user.username
  44 if isinstance(username, unicode):
  45 username = username.encode('utf-8')

 AttributeError: 'int' object has no attribute 'username'

 }}}
 My manager has only one method and did n"t use it.
 I have only one model and I already gave my 'models.py' code here is a
 pastebin : http://pastebin.com/0qSkeveT
 Their is no view code involved, the same weird behaviour happens with the
 'manage.py shell_plus' command.
 Also I am using postgresql 8.4.17 on ubuntu 12.04 LTS, thanks for your
 support.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.4bd03d6d6809ecec3b9c9c3e2e84758d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20795: Weird queryset behaviour and count() method

2013-07-24 Thread Django
#20795: Weird queryset behaviour and count() method
-+-
 Reporter:  maa@…|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Release blocker  | Triage Stage:
 Keywords:  count queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by CollinAnderson):

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


Comment:

 What does your unicode method look like?
 What does len(EmailChangeLog.objects.all()) return?
 Do you have any other manager methods?
 Could you narrow your problematic models down to the simplest form while
 still being able to reproduce the problem, and then share them somewhere?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.2b669b64926a33e20055cd607eeef48f%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.