Re: [Django] #34975: aggregate() crashes when referencing existing aggregations or window expressions through conditional expressions

2023-11-17 Thread Django
#34975: aggregate() crashes when referencing existing aggregations or window
expressions through conditional expressions
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sergey Nesterenko):

 Replying to [comment:7 Simon Charette]:
 > `filter=Q(new_ordering=F('ordering'))` instead of
 `filter=Q(ordering=F('new_ordering'))`.

 Yes, it solves my problem. Thankx!

-- 
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/0107018be13110fa-2304d8fa-9bea-49b0-adeb-9ba14125983e-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: aggregate() crashes when referencing existing aggregations or window expressions through conditional expressions (was: Getting refs does not work properly with models.Window and a

2023-11-17 Thread Django
#34975: aggregate() crashes when referencing existing aggregations or window
expressions through conditional expressions
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  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 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/0107018be03b72f8-f1ea1abc-b03b-4dd6-85f8-6daf432a61ab-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * has_patch:  0 => 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018be0371665-c6309a4b-df39-4c7c-aba3-5dacacd5deea-00%40eu-central-1.amazonses.com.


Re: [Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
---+--
 Reporter:  Oliver Ford|Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Uncategorized  |  Version:  4.2
 Severity:  Normal |   Resolution:  duplicate
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by Jacob Walls):

 There is a simple way to get the full migration file: you can run
 `makemigrations --check --verbosity 3` (that is, once 4.2.8 is out).

-- 
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/0107018be02bcdaa-9a1cc1e8-247c-469b-9cc8-705a0c125f6d-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * severity:  Normal => Release blocker


Comment:

 Confirmed regression in b181cae2e3697b2e53b5b67ac67e59f3b05a6f0d, refs
 #25307.

-- 
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/0107018be00c4f18-1b67d316-257e-43eb-aef0-c7aaac2b169e-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 I've got an idea of how to solve this, it's not clear to me if it's a
 regression as the underlying cause has little to do with window functions.

 In the mean time, can you confirm that switching the order of your lookup
 resolve the issue. That is doing `filter=Q(new_ordering=F('ordering'))`
 instead of `filter=Q(ordering=F('new_ordering'))`.

-- 
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/0107018bdf9c2a66-0105dc94-41e3-49ab-9c76-3c38dba06811-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * owner:  nobody => Simon Charette
 * status:  new => assigned


-- 
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/0107018bdf99c4e1-4f580a20-9949-476d-acd5-9b3d3780-00%40eu-central-1.amazonses.com.


Re: [Django] #33166: Add "field" to the context when rendering widgets.

2023-11-17 Thread Django
#33166: Add "field" to the context when rendering widgets.
-+-
 Reporter:  Jacob Rief   |Owner:  Jacob
 |  Rief
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  4.0
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  form, widget,| Triage Stage:
  context|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * needs_better_patch:  1 => 0
 * has_patch:  1 => 0
 * resolution:   => wontfix
 * stage:  Accepted => Unreviewed


Comment:

 I think it's no longer needed after
 cad376f844c7bd7607a7c0ea8ae52061309b.

-- 
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/0107018bdec85e58-3245c65b-756b-465a-ab9b-b9e40dce58e2-00%40eu-central-1.amazonses.com.


Re: [Django] #34429: Allow to set unusable password via admin UI

2023-11-17 Thread Django
#34429: Allow to set unusable password via admin UI
-+
 Reporter:  Tobias Bengfort  |Owner:  Fabian Braun
 Type:  New feature  |   Status:  assigned
Component:  contrib.auth |  Version:  dev
 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:  1
-+
Changes (by Natalia Bidart):

 * needs_better_patch:  0 => 1


Comment:

 Made many rounds of reviews, including a great conversation about UX of
 this feature
 
([https://discord.com/channels/856567261900832808/859997770274045954/1174701788000178217
 see Discord chat]).

-- 
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/0107018bdebaedee-524c7d0c-6033-4482-a0e7-cec0b767e9fb-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sergey Nesterenko):

 Replying to [comment:4 Simon Charette]:
 > I'm not sure if something else will break as I don't think we have
 extensive testing for performing filtered aggregation over a window
 function but does the following patch helps
 >
 > {{{#!python
 > diff --git a/django/db/models/expressions.py
 b/django/db/models/expressions.py
 > index 3a0c75ebf2..74ae9cab8e 100644
 > --- a/django/db/models/expressions.py
 > +++ b/django/db/models/expressions.py
 > @@ -417,6 +417,8 @@ def replace_expressions(self, replacements):
 >  def get_refs(self):
 >  refs = set()
 >  for expr in self.get_source_expressions():
 > +if expr is None:
 > +continue
 >  refs |= expr.get_refs()
 >  return refs
 > }}}


 I thought about it, but I wasn't sure it wouldn't break anything, but it
 might work.

-- 
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/0107018bde8126dd-fdadeef2-d87d-4fd6-88d4-9708f86d8399-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 I'm not sure if something else will break as I don't think we have
 extensive testing for performing filtered aggregation over a window
 function but does the following patch helps

 {{{#!python
 diff --git a/django/db/models/expressions.py
 b/django/db/models/expressions.py
 index 3a0c75ebf2..74ae9cab8e 100644
 --- a/django/db/models/expressions.py
 +++ b/django/db/models/expressions.py
 @@ -417,6 +417,8 @@ def replace_expressions(self, replacements):
  def get_refs(self):
  refs = set()
  for expr in self.get_source_expressions():
 +if expr is None:
 +continue
  refs |= expr.get_refs()
  return refs
 }}}

-- 
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/0107018bde7cf397-96dc58b4-79f8-4866-8187-88aa874816d4-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:  Accepted
  Aggregate, F   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * stage:  Unreviewed => Accepted


Comment:

 Another instance of a crash due to mishandling of
 `get_source_expressions()` being `Expression | 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bde7a1a79-bfb482f5-daa2-4b88-9963-6e1ed0456a24-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs does not work properly with models.Window and aggregation (was: Getting refs is not work properly with models.Window and aggregation)

2023-11-17 Thread Django
#34975: Getting refs does not work properly with models.Window and aggregation
-+-
 Reporter:  Sergey Nesterenko|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:
  Aggregate, F   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  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 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/0107018bde61bc45-d9c4c0bc-b600-4189-b21b-50229dedd801-00%40eu-central-1.amazonses.com.


Re: [Django] #34975: Getting refs is not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs is not work properly with models.Window and aggregation
-+-
 Reporter:  Zwergpro |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  QuerySet, Window,| Triage Stage:
  Aggregate, F   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Zwergpro:

Old description:

> I found out that getting refs in QuerySet doesn't work with models.Window
> when I try to use aggregate method. It happened when I tried to update
> Django to 4.2.7.
>
> For example:
> {{{
> MyModel.objects.annotate(
> new_ordering=Window(RowNumber(),  order_by=[F('ordering')])
> ).aggregate(
> wrong_count=Count('id', filter=Q(ordering=F('new_ordering')))
> )
> }}}
>
> And as a result, it fails with:
> {{{
> Traceback (most recent call last):
>   File "/main.py", line 38, in 
> result = ordering_query.aggregate(
>   File "/python3.10/site-packages/django/db/models/query.py", line 592,
> in aggregate
> return self.query.chain().get_aggregation(self.db, kwargs)
>   File "/python3.10/site-packages/django/db/models/sql/query.py", line
> 398, in get_aggregation
> aggregate = aggregate_expr.resolve_expression(
>   File "/python3.10/site-packages/django/db/models/aggregates.py", line
> 70, in resolve_expression
> for ref in c.get_refs():
>   File "/python3.10/site-packages/django/db/models/expressions.py", line
> 418, in get_refs
> refs |= expr.get_refs()
>   File "/python3.10/site-packages/django/db/models/sql/where.py", line
> 233, in get_refs
> refs |= child.get_refs()
>   File "/python3.10/site-packages/django/db/models/expressions.py", line
> 418, in get_refs
> refs |= expr.get_refs()
>   File "/python3.10/site-packages/django/db/models/expressions.py", line
> 418, in get_refs
> refs |= expr.get_refs()
> AttributeError: 'NoneType' object has no attribute 'get_refs'
> }}}
>
> It happens because of Window.get_source_expressions return:
> {{{
> def get_source_expressions(self):
> return [self.source_expression, self.partition_by, self.order_by,
> self.frame]
> }}}
> and if we don't specify 'frame' (for example) it will be None in the
> list.
>
> And in models.aggregates.Aggregate.resolve_expression when we try to find
> all refs
> https://github.com/django/django/blob/47f9b8dca16b1fdc054b338d81eb080eabad0edf/django/db/models/aggregates.py#L70C30-L70C30
> it fails because of we have None in Window.get_source_expressions
> {{{
> def get_refs(self):
> refs = set()
> for expr in self.get_source_expressions():
> refs |= expr.get_refs()
> return refs
> }}}

New description:

 I found out that getting refs in QuerySet doesn't work with models.Window
 when I try to use aggregate method. It happened when I tried to update
 Django to 4.2.7.

 For example:
 {{{
 MyModel.objects.annotate(
 new_ordering=Window(RowNumber(),  order_by=[F('ordering')])
 ).aggregate(
 new_count=Count('id', filter=Q(ordering=F('new_ordering')))
 )
 }}}

 And as a result, it fails with:
 {{{
 Traceback (most recent call last):
   File "/main.py", line 38, in 
 result = ordering_query.aggregate(
   File "/python3.10/site-packages/django/db/models/query.py", line 592, in
 aggregate
 return self.query.chain().get_aggregation(self.db, kwargs)
   File "/python3.10/site-packages/django/db/models/sql/query.py", line
 398, in get_aggregation
 aggregate = aggregate_expr.resolve_expression(
   File "/python3.10/site-packages/django/db/models/aggregates.py", line
 70, in resolve_expression
 for ref in c.get_refs():
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
   File "/python3.10/site-packages/django/db/models/sql/where.py", line
 233, in get_refs
 refs |= child.get_refs()
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
 AttributeError: 'NoneType' object has no attribute 'get_refs'
 }}}

 It happens because of Window.get_source_expressions return:
 {{{
 def get_source_expressions(self):
 return [self.source_expression, self.partition_by, self.order_by,
 self.frame]
 }}}
 and if we don't specify 'frame' (for example) it will be None in the list.

 And 

[Django] #34975: Getting refs is not work properly with models.Window and aggregation

2023-11-17 Thread Django
#34975: Getting refs is not work properly with models.Window and aggregation
-+-
   Reporter:  Zwergpro   |  Owner:  nobody
   Type:  Bug| Status:  new
  Component:  Database   |Version:  4.2
  layer (models, ORM)|   Keywords:  QuerySet, Window,
   Severity:  Normal |  Aggregate, F
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 I found out that getting refs in QuerySet doesn't work with models.Window
 when I try to use aggregate method. It happened when I tried to update
 Django to 4.2.7.

 For example:
 {{{
 MyModel.objects.annotate(
 new_ordering=Window(RowNumber(),  order_by=[F('ordering')])
 ).aggregate(
 wrong_count=Count('id', filter=Q(ordering=F('new_ordering')))
 )
 }}}

 And as a result, it fails with:
 {{{
 Traceback (most recent call last):
   File "/main.py", line 38, in 
 result = ordering_query.aggregate(
   File "/python3.10/site-packages/django/db/models/query.py", line 592, in
 aggregate
 return self.query.chain().get_aggregation(self.db, kwargs)
   File "/python3.10/site-packages/django/db/models/sql/query.py", line
 398, in get_aggregation
 aggregate = aggregate_expr.resolve_expression(
   File "/python3.10/site-packages/django/db/models/aggregates.py", line
 70, in resolve_expression
 for ref in c.get_refs():
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
   File "/python3.10/site-packages/django/db/models/sql/where.py", line
 233, in get_refs
 refs |= child.get_refs()
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
   File "/python3.10/site-packages/django/db/models/expressions.py", line
 418, in get_refs
 refs |= expr.get_refs()
 AttributeError: 'NoneType' object has no attribute 'get_refs'
 }}}

 It happens because of Window.get_source_expressions return:
 {{{
 def get_source_expressions(self):
 return [self.source_expression, self.partition_by, self.order_by,
 self.frame]
 }}}
 and if we don't specify 'frame' (for example) it will be None in the list.

 And in models.aggregates.Aggregate.resolve_expression when we try to find
 all refs
 
https://github.com/django/django/blob/47f9b8dca16b1fdc054b338d81eb080eabad0edf/django/db/models/aggregates.py#L70C30-L70C30
 it fails because of we have None in Window.get_source_expressions
 {{{
 def get_refs(self):
 refs = set()
 for expr in self.get_source_expressions():
 refs |= expr.get_refs()
 return refs
 }}}

-- 
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/0107018bdde1938f-56612631-fa3d-43e2-b63d-ebfd5f9123dd-00%40eu-central-1.amazonses.com.


Re: [Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
---+--
 Reporter:  Oliver Ford|Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Uncategorized  |  Version:  4.2
 Severity:  Normal |   Resolution:  duplicate
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by David Sanders):

 > Is there already a feature request for a --dry-run --diff or something
 do you know?

 I don't believe there is sorry 路‍♂️

 If you want to write something yourself you can update makemigrations to
 simply write to `sys.stdout`:

 {{{
 @@ -360,9 +360,8 @@ class Command(BaseCommand):
  # We just do this once per app
  directory_created[app_label] = True
  migration_string = writer.as_string()
 -with open(writer.path, "w", encoding="utf-8") as fh:
 -fh.write(migration_string)
 -self.written_files.append(writer.path)
 +sys.stdout.write(migration_string)
 +self.written_files.append(writer.path)
  if update_previous_migration_paths:
  prev_path =
 update_previous_migration_paths[app_label]
  rel_prev_path = self.get_relative_path(prev_path)
 }}}

 That will print both the log message that shows the written file + the
 contents.  You can disable the logging easily with `-v 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 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/0107018bdda8783d-e23abb07-97a9-44a0-8fda-2d649bb9a723-00%40eu-central-1.amazonses.com.


Re: [Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
---+--
 Reporter:  Oliver Ford|Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Uncategorized  |  Version:  4.2
 Severity:  Normal |   Resolution:  duplicate
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by Oliver Ford):

 Ah, what I was actually hoping for was the full contents of the file, not
 just the would-be file name, and model it affects.

 But it seems I misunderstood, and `--dry-run` doesn't do that either. Is
 there already a feature request for a `--dry-run --diff` or something do
 you know?

 i.e. to build in what would be worked around by _not_ using `--dry-run`,
 grepping out the filename and printing the contents.

-- 
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/0107018bdd9aeb49-2c9b327b-2184-4611-9e15-a3aaac97e4da-00%40eu-central-1.amazonses.com.


Re: [Django] #34972: Aggregate with CombinedExpression resulting in NotImplemented instead of None after update from 3.2 -> 4.2

2023-11-17 Thread Django
#34972: Aggregate with CombinedExpression resulting in NotImplemented instead of
None after update from 3.2 -> 4.2
-+-
 Reporter:  ElRoberto538 |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |   Resolution:
 Severity:  Normal   |  worksforme
 Keywords:  CombinedExpression,  | Triage Stage:
  NotImplemented, aggregate  |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by David Sanders):

 * cc: David Sanders (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 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/0107018bdd932681-cf6e7e50-36ce-4dd2-8e44-0a2f8a50b2e6-00%40eu-central-1.amazonses.com.


Re: [Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
---+--
 Reporter:  Oliver Ford|Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Uncategorized  |  Version:  4.2
 Severity:  Normal |   Resolution:  duplicate
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by David Sanders):

 Also FYI here's the release post for 4.2.8:
 https://docs.djangoproject.com/en/dev/releases/4.2.8/

 Expected 4 December 2023

-- 
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/0107018bdd8a8a9d-45bc1a10-deb6-4424-940a-4eb24aeb8ef8-00%40eu-central-1.amazonses.com.


Re: [Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
---+--
 Reporter:  Oliver Ford|Owner:  nobody
 Type:  Uncategorized  |   Status:  closed
Component:  Uncategorized  |  Version:  4.2
 Severity:  Normal |   Resolution:  duplicate
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by David Sanders):

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


Comment:

 Hi Oliver,

 Thanks for the report. The documentation was for a patch that was recently
 added to the 4.2.x branch with #34457. The patch was only merged 8 days
 ago and doesn't look like it's released yet. Please bear with us as we
 await its release :)

 Marking as duplicate of #34457.

-- 
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/0107018bdd719bb1-ad7f9015-cdd1-409d-b260-cb449761ed51-00%40eu-central-1.amazonses.com.


[Django] #34974: makemigrations --check does not show diff as documented

2023-11-17 Thread Django
#34974: makemigrations --check does not show diff as documented
-+
   Reporter:  Oliver Ford|  Owner:  nobody
   Type:  Uncategorized  | Status:  new
  Component:  Uncategorized  |Version:  4.2
   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  |
-+
 The [docs](https://docs.djangoproject.com/en/4.2/ref/django-admin/#django-
 admin-makemigrations) say:

 >--check¶
 >Makes makemigrations exit with a non-zero status when model changes
 without migrations are detected. **Implies --dry-run**.

 which:
 >--dry-run¶
 >**Shows what migrations would be made** without actually writing any
 migrations files to disk. Using this option along with --verbosity 3 will
 also show the complete migrations files that would be written.

 emphasis mine.

 In CI, would be very useful to have a single command which both renders
 the missing/problematic migration and also exits non-zero; I think this
 should be `makemigrations --check`, as it's already documented as doing.

 Alternatively, maybe `--check` should _not_ imply `--dry-run` at all in
 any sense - i.e. it should write to disk if `--dry-run` not given. I'm not
 sure I like that though, I think it makes sense that 'check' is
 idempotent.

 Black for example has `--diff` rather than `--dry-run`, and both prevent
 writing to disk, but can be combined for an exit code as well as the
 change printed:

 >--check Don't write the files back, just return
 the
   status. Return code 0 means nothing
 would
   change. Return code 1 means some files
 would
   be reformatted. Return code 123 means
 there
   was an internal error.

 >--diff  Don't write the files back, just output a
  diff for each file on stdout.

 (can't figure out this formatting...)

-- 
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/0107018bdd6b25a2-d1732d01-082d-4a0a-a8a1-bd45b24dd5d7-00%40eu-central-1.amazonses.com.


Re: [Django] #34973: Allow making unpickling warnings an error

2023-11-17 Thread Django
#34973: Allow making unpickling warnings an error
-+-
 Reporter:  stefan6419846|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  4.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

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


Comment:

 Thanks for the report, however you should be able to make these warnings
 errors using `warnings.filterwarnings()`. There is no need to change
 anything in Django itself.

-- 
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/0107018bdcf74c1f-3ab7627a-19d6-499c-a17c-a3e3873565c2-00%40eu-central-1.amazonses.com.


[Django] #34973: Allow making unpickling warnings an error

2023-11-17 Thread Django
#34973: Allow making unpickling warnings an error
-+-
   Reporter: |  Owner:  nobody
  stefan6419846  |
   Type:  New| Status:  new
  feature|
  Component:  Database   |Version:  4.2
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 In #21430 (https://github.com/django/django/commit/42736ac), unpickling
 has been changed to log a warning for incompatible versions. While this
 raises awareness, this is not really practical if you have lots of
 deployments to consider.

 We are using mostly automated deployments to quickly provide the latest
 changes to our customers. Whenever we update to a newer Django, we need to
 clear the whole cache. Automating this requires special handling, as
 running the cache invalidation on every deployment seems to be overkill
 for unrelated updates - thus some custom logic is required to only force
 an invalidation on Django package changes when necessary at the moment.

 For this reason, I would like to propose an additional/changed solution
 which turns this into hard failures which can be handled by my application
 without having to invalidate the cache itself. This way, I am able to
 cleanly detect this and handle it appropriately.

 Due to being a backwards-incompatible change, this might be changed by a
 new setting which defaults to the old behavior.

-- 
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/0107018bdcdf7d8c-e443673a-8a9d-41a7-875a-462531107f59-00%40eu-central-1.amazonses.com.


Re: [Django] #34965: @sensitive_variables for coroutine func are not recursive

2023-11-17 Thread Django
#34965: @sensitive_variables for coroutine func are not recursive
-+-
 Reporter:  Vageeshan Mankala|Owner:  vageeshan
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  5.0
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
  @sensitive_variables,  |  Unreviewed
  @sensitive_post_parameters |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 Replying to [comment:11 Carlton Gibson]:
 > Thanks for the ping. Yes, with the change to asgiref, it seems
 reasonable to drop the warnings. (I didn't check the internal Python
 frames again, but they're future related, and don't feature sensitive
 Django-related variables…)

 [https://github.com/django/django/pull/17484 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bdcd6fe41-b4294e1e-12e9-4355-b531-01e791612df3-00%40eu-central-1.amazonses.com.


Re: [Django] #31700: Highlight destructive operations in makemigrations output

2023-11-17 Thread Django
#31700: Highlight destructive operations in makemigrations output
-+---
 Reporter:  Tom Forbes   |Owner:  Amir Karimi
 Type:  New feature  |   Status:  assigned
Component:  Migrations   |  Version:  dev
 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 Amir Karimi):

 * needs_better_patch:  1 => 0
 * needs_docs:  1 => 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 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/0107018bdcbbd34b-63bed2da-8465-4906-bd7a-26576ea9c556-00%40eu-central-1.amazonses.com.


Re: [Django] #32819: Fields’ help text and errors should be associated with input

2023-11-17 Thread Django
#32819: Fields’ help text and errors should be associated with input
-+-
 Reporter:  Thibaud Colas|Owner:  David
 |  Smith
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  accessibility, ui,   | Triage Stage:  Accepted
  forms  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  1
-+-
Changes (by Mariusz Felisiak):

 * has_patch:  1 => 0
 * stage:  Ready for checkin => 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/0107018bdc4d017d-570bad09-d080-45bd-90dc-c95a5fcf754c-00%40eu-central-1.amazonses.com.


Re: [Django] #32819: Fields’ help text and errors should be associated with input

2023-11-17 Thread Django
#32819: Fields’ help text and errors should be associated with input
-+-
 Reporter:  Thibaud Colas|Owner:  David
 |  Smith
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  accessibility, ui,   | Triage Stage:  Ready for
  forms  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  1
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"557fa51837a57534f8ca486133a412547a98a37e" 557fa51]:
 {{{
 #!CommitTicketReference repository=""
 revision="557fa51837a57534f8ca486133a412547a98a37e"
 Refs #32819 -- Added aria-describedby test for widgets with custom id.
 }}}

-- 
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/0107018bdc4c9b95-77e764aa-1bd8-4f14-9f78-c271797e8b69-00%40eu-central-1.amazonses.com.


Re: [Django] #32819: Fields’ help text and errors should be associated with input

2023-11-17 Thread Django
#32819: Fields’ help text and errors should be associated with input
-+-
 Reporter:  Thibaud Colas|Owner:  David
 |  Smith
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  accessibility, ui,   | Triage Stage:  Ready for
  forms  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  1
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"eec7e9ba894a7815d289ba7446eeead488fe0e33" eec7e9ba]:
 {{{
 #!CommitTicketReference repository=""
 revision="eec7e9ba894a7815d289ba7446eeead488fe0e33"
 Refs #32819 -- Established relationship between form fieldsets and their
 help text.

 This adds aria-describedby for widgets rendered in a fieldset such as
 radios. aria-describedby for these widgets is added to the 
 element rather than each .
 }}}

-- 
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/0107018bdc4c9bf3-1add6e5f-63ba-4c82-b0f7-12d7c0f3b739-00%40eu-central-1.amazonses.com.