Re: [Django] #31115: ORM generates wrong alias for subquery

2019-12-22 Thread Django
#31115: ORM generates wrong alias for subquery
-+-
 Reporter:  Dmitriy Gunchenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  orm, alias   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Looks like the `external_aliases` tweaks of
 5a4d7285bd10bd40d9f7e574a7c421eb21094858 which will be part of Django
 3.0.2 happened to address this issue or at least the following regression
 test which crashes on PostgreSQL without the test.

 {{{#!diff
 diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
 index 5ba2e180e0..4febf96d94 100644
 --- a/tests/aggregation/tests.py
 +++ b/tests/aggregation/tests.py
 @@ -1190,3 +1190,15 @@ class AggregateTestCase(TestCase):
  contact_publisher__isnull=False,
  ).annotate(count=Count('authors'))
  self.assertSequenceEqual(books_qs, [book])
 +
 +def test_nested_subquery_join_outerref(self):
 +list(Author.objects.annotate(
 +friends_book=Subquery(Book.objects.filter(
 +authors__in=Subquery(
 +Author.objects.filter(
 +id=OuterRef('authors__friends__id'),
 +).values('pk')
 +),
 +authors__friends__id=OuterRef('id'),
 +).values('pk'))
 +))
 }}}

 Dmitriy, could you form your issue is effectively addressed by the
 aforementioned patch?

 I guess we should polish the test and add it to the suite at an
 appropriate location given it has nothing to do with aggregation.
 Thoughts?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.1123a57e37045b991b342153a4efa1b7%40djangoproject.com.


Re: [Django] #25594: Difficult to customize model field default_validators and have them used on both model and form fields

2019-12-22 Thread Django
#25594: Difficult to customize model field default_validators and have them 
used on
both model and form fields
-+-
 Reporter:  Marcin Nowak |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Federico Jaramillo Martínez):

 If my proposed solution sounds good, I can work on it.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.0c4a9497ae82cb4a32a5342e46f6e812%40djangoproject.com.


Re: [Django] #31115: ORM generates wrong alias for subquery

2019-12-22 Thread Django
#31115: ORM generates wrong alias for subquery
-+-
 Reporter:  Dmitriy Gunchenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  orm, alias   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * status:  new => assigned
 * owner:  nobody => Simon Charette
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 Alias quoting issues like that happen when an entry goes missing in
 `Query.external_aliases`.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.a584130a07d9b0eb4c1f91dc111b9901%40djangoproject.com.


Re: [Django] #25594: Difficult to customize model field default_validators and have them used on both model and form fields

2019-12-22 Thread Django
#25594: Difficult to customize model field default_validators and have them 
used on
both model and form fields
-+-
 Reporter:  Marcin Nowak |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Federico Jaramillo Martínez):

 From a design perspective, wouldn't it be clearer to have a new arguments
 for every `FormField` and `ModelField` that disables the default
 validators?
 Something like `disable_default_validators=False`.

 When instantiating a field, one can  set it to `True`, and this will
 disable all `default_validators`, and if it is set on a model field, will
 be propagated to the form field.

 This way, the developer is in full control of the validators, both for the
 model field and the form field. Less magic, and more clear what is going
 on.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.3fc50e218536a7ae7721d8b06b98bcec%40djangoproject.com.


Re: [Django] #31115: ORM generates wrong alias for subquery

2019-12-22 Thread Django
#31115: ORM generates wrong alias for subquery
-+-
 Reporter:  terkin   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  orm, alias   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by terkin):

 * type:  New feature => Bug


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.ea7b1d42d89f30b8e3db9d87aa698eb2%40djangoproject.com.


[Django] #31115: ORM generates wrong alias for subquery

2019-12-22 Thread Django
#31115: ORM generates wrong alias for subquery
-+-
   Reporter:  terkin |  Owner:  nobody
   Type:  New| Status:  new
  feature|
  Component:  Database   |Version:  3.0
  layer (models, ORM)|
   Severity:  Normal |   Keywords:  orm, alias
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Its used to work fine at Django 2.2.1 but bug was introduced since Django
 3.0a

 {{{
 qs = Profile.objects
 latest_events =
 
Event.objects.filter(user_id=OuterRef("addresses__ad__events__user_id")).order_by("-instance_created_date").values("pk")[10]

 most_viewed =
 City.objects.filter(addresses__ad__events__in=Subquery(latest_events),
 
addresses__ad__events__user_id=OuterRef("user_id")).annotate(cnt=Count("addresses__ad__events")).order_by("-cnt").values("pk")[:1]

 qs.annotate(preferred_city=Subquery(queryset=most_viewed,
 output_field=models.IntegerField()))
 }}}
 and this code generates SQL like this:

 {{{
 SELECT "profile"."id",
"profile"."instance_created_date",
"profile"."instance_modified_date",
 ...
"profile"."user_id",

   (SELECT V0."id"
FROM "city" V0
INNER JOIN "address" V1 ON (V0."id" = V1."city_id")
INNER JOIN "ad" V2 ON (V1."ad_id" = V2."id")
INNER JOIN "event" V3 ON (V2."id" = V3."ad_id")
WHERE (V3."id" IN
 (SELECT U0."id"
  FROM "event" U0
  WHERE U0."user_id" ="V3"."user_id"
  ORDER BY U0."instance_created_date" DESC
  LIMIT 5)
   AND V3."user_id" = "profile"."user_id")
GROUP BY V0."id"
ORDER BY COUNT(V3."id") DESC
LIMIT 1) AS "preferred_city"
 FROM "profile"
 }}}
 so the problem with this part: **WHERE U0."user_id" ="V3"."user_id"** for
 some reason here V3 alias became quoted

 I am using django.db.backends.postgresql, psycopg2==2.8.4, bug reproduces
 at django v3.0.1 as well

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.ddc52c08fb8143fd663bd499bba4814c%40djangoproject.com.


Re: [Django] #31114: request.build_absolute_uri does not support reverse_lazy

2019-12-22 Thread Django
#31114: request.build_absolute_uri does not support reverse_lazy
+
 Reporter:  Dmitrij Strelnikov  |Owner:  nobody
 Type:  Bug |   Status:  new
Component:  Core (URLs) |  Version:  master
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  0   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  0
Easy pickings:  1   |UI/UX:  0
+
Changes (by Claude Paroz):

 * version:  3.0 => master
 * type:  Uncategorized => Bug
 * easy:  0 => 1
 * stage:  Unreviewed => Accepted


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.9bb4fbc7ae0485b7b244339e7a2da7b8%40djangoproject.com.


Re: [Django] #10941: Add a templatetag to generate querystrings

2019-12-22 Thread Django
#10941: Add a templatetag to generate querystrings
-+
 Reporter:  Ben Spaulding|Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Template system  |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  pagination   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by Claude Paroz):

 Sure, it's still valid. Read attentively the existing comments.

 Maybe the greatest challenge of this ticket is to find a compromise
 between functionality and simplicity, addressing the more common use cases
 while accepting it won't address all possible needs.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.3cca8993bfa7703678cb7608a4bd4515%40djangoproject.com.


Re: [Django] #1028: High-level feed framework should make more feed elements available

2019-12-22 Thread Django
#1028: High-level feed framework should make more feed elements available
-+-
 Reporter:  James Bennett|Owner:  Tom
 |  Carrick
 Type:  New feature  |   Status:  assigned
Component:  contrib.syndication  |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  djangocon| Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tom Carrick):

 * status:  new => assigned
 * owner:  (none) => Tom Carrick


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.615dfb29b1c32e4b9223f0dbb49b2e84%40djangoproject.com.


[Django] #31114: request.build_absolute_uri does not support reverse_lazy

2019-12-22 Thread Django
#31114: request.build_absolute_uri does not support reverse_lazy
--+
   Reporter:  Dmitrij Strelnikov  |  Owner:  nobody
   Type:  Uncategorized   | Status:  new
  Component:  Core (URLs) |Version:  3.0
   Severity:  Normal  |   Keywords:
   Triage Stage:  Unreviewed  |  Has patch:  0
Needs documentation:  0   |Needs tests:  0
Patch needs improvement:  0   |  Easy pickings:  0
  UI/UX:  0   |
--+
 {{{
 redirect_uri = 'google_callback'

 print('reverse')
 print(request.build_absolute_uri(reverse(self.redirect_uri)))
 print('lazy')
 print(request.build_absolute_uri(reverse_lazy(self.redirect_uri)))
 }}}

 {{{
 reverse
 SplitResult(scheme='', netloc='', path='/google/callback/', query='',
 fragment='')
 lazy
 File "/Users/.pyenv/versions/3.8.1/lib/python3.8/urllib/parse.py", line
 108, in 
 return tuple(x.decode(encoding, errors) if x else '' for x in args)
 AttributeError: '__proxy__' object has no attribute 'decode'
 }}}

 exception is raised by `from urllib.parse import urlsplit`
 I think it's the same issue as https://code.djangoproject.com/ticket/18776

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.b0c11573fe3c152e42faae2f475aac3e%40djangoproject.com.