[Django] #30302: forms.models.model_to_dict fails when `fields` is empty list

2019-03-31 Thread Django
#30302: forms.models.model_to_dict fails when `fields` is empty list
--+
   Reporter:  Belegnar|  Owner:  nobody
   Type:  Bug | Status:  new
  Component:  Forms   |Version:  2.1
   Severity:  Normal  |   Keywords:
   Triage Stage:  Unreviewed  |  Has patch:  1
Needs documentation:  0   |Needs tests:  0
Patch needs improvement:  0   |  Easy pickings:  0
  UI/UX:  0   |
--+
 Been called as `model_to_dict(instance, fields=[])` function should return
 empty dict, because no fields were requested. But it returns all fields
 The problem point is

 `if fields and f.name not in fields:`

 which should be
 `if fields is not None and f.name not in fields:`

 PR: https://github.com/django/django/pull/11150/files

-- 
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/051.bfd3ad880c391ab4660d7eaff1d76e40%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29338: Can't use OuterRef in union Subquery

2019-03-31 Thread Django
#29338: Can't use OuterRef in union Subquery
-+-
 Reporter:  Matthew Pava |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Can Sarıgöl):

 > {{{
 > cls = Document.objects.filter(
 > checklist__isnull=False,
 > part=OuterRef('id')
 > ).values('checklist__customer', 'created')
 >
 > ots = Document.objects.filter(
 > ownershiptransfer__isnull=False,
 > part=OuterRef('id')
 > ).values('ownershiptransfer__ship_target__contact', 'created')
 >
 > return self.annotate(
 > owner=Subquery(cls.union(ots).values('owner')[:1])
 > )
 > }}}

 I change the example like this:


 {{{
 cls = Document.objects.filter(
 checklist__isnull=False,
 ).values('checklist__customer', 'created')

 ots = Document.objects.filter(
 ownershiptransfer__isnull=False,
 ).values('ownershiptransfer__ship_target__contact', 'created')

 return self.annotate(
 owner=Subquery(cls.union(ots).filter(part=OuterRef('id')).values('owner')[:1])
 )
 }}}

-- 
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/064.aabf9fe130b47b7ef1bbbf0472236465%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29338: Can't use OuterRef in union Subquery

2019-03-31 Thread Django
#29338: Can't use OuterRef in union Subquery
-+-
 Reporter:  Matthew Pava |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Can Sarıgöl):

 * cc: Can Sarıgöl (added)
 * has_patch:  0 => 1


Comment:

 hi, I thought that we can use union queries in subqueries by replacing the
 alias from origin query to union queries. I've pushed a commit. if this
 approach is ok, I can add other tests and go further?
 [https://github.com/django/django/pull/11152 PR]

-- 
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/064.59c7b444768ff3de8cc1f52dc956f3d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30259: Support the use of admin_order_field on properties in the admin.

2019-03-31 Thread Django
#30259: Support the use of admin_order_field on properties in the admin.
-+
 Reporter:  Tobias Wiese |Owner:  Jani Tiainen
 Type:  New feature  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by Jani Tiainen):

 Replying to [comment:7 Tim Graham]:
 > A selenium test fails after the patch:
 `admin_views.tests.SeleniumTests.test_list_editable_raw_id_fields`:
 > {{{
 >   File
 "/home/tim/code/django/django/contrib/admin/templatetags/admin_list.py",
 line 133, in result_headers
 > admin_order_field = getattr(attr.fget, 'admin_order_field')
 > AttributeError: 'function' object has no attribute 'admin_order_field'
 > }}}

 Apparently that `getattr` should be:
 {{{
 admin_order_field = getattr(attr.fget, 'admin_order_field', None)
 }}}

-- 
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/069.f7a3072cb737d3c1ccc058c213df8d7a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.